File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,11 @@ enum DocumentProcessor: string
1717 * Uses https://github.com/pymupdf/PyMuPDF as document processor to extract text
1818 */
1919 case PYMUPDF = 'pymupdf ' ;
20+
21+ /**
22+ * The LLama Parse processor
23+ *
24+ * Uses LLamaCloud https://cloud.llamaindex.ai/ as document processor to extract text
25+ */
26+ case LLAMAPARSE = 'llama ' ;
2027}
Original file line number Diff line number Diff line change 6868
6969 $ mockClient ->assertSentCount (1 );
7070});
71+
72+ test ('llamaparse can be selected as processor ' , function () {
73+ $ mockClient = MockClient::global ([
74+ ExtractTextRequest::class => MockResponse::fixture ('extract-text-empty ' ),
75+ ]);
76+
77+ $ connector = new ParseConnector ('fake ' , 'http://localhost:5002 ' );
78+ $ connector ->withMockClient ($ mockClient );
79+
80+ $ connector ->parse (
81+ url: 'http://localhost/empty.pdf ' ,
82+ options: new ParseOption (DocumentProcessor::LLAMAPARSE ),
83+ );
84+
85+ $ mockClient ->assertSent (ExtractTextRequest::class);
86+
87+ $ mockClient ->assertSent (function (Request $ request , Response $ response ) {
88+ if (! $ request instanceof ExtractTextRequest) {
89+ return false ;
90+ }
91+
92+ /** @var array */
93+ $ body = $ request ->body ()->all ();
94+
95+ return $ body ['url ' ] === 'http://localhost/empty.pdf '
96+ && $ body ['mime_type ' ] === 'application/pdf '
97+ && $ body ['driver ' ] === 'llama ' ;
98+ });
99+
100+ $ mockClient ->assertSentCount (1 );
101+ });
You can’t perform that action at this time.
0 commit comments