Skip to content

Commit

Permalink
Update unstructured docs (#189)
Browse files Browse the repository at this point in the history
* initial import

* nit

* initial import

* Update integrations/unstructured-file-converter.md

Co-authored-by: Stefano Fiorucci <[email protected]>

---------

Co-authored-by: Stefano Fiorucci <[email protected]>
  • Loading branch information
davidsbatista and anakin87 authored Feb 20, 2024
1 parent 3a7fe36 commit eba53a9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions integrations/unstructured-file-converter.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ docker run -p 8000:8000 -d --rm --name unstructured-api quay.io/unstructured-io/

## Usage

If you plan to use the hosted version of the Unstructured API, set the Unstructured API key as an environment variable `UNSTRUCTURED_API_KEY`:
```bash
export UNSTRUCTURED_API_KEY=your_api_key
```

### In isolation
```python
import os
from haystack_integrations.components.converters.unstructured import UnstructuredFileConverter

converter = UnstructuredFileConverter(api_key="UNSTRUCTURED_API_KEY")
converter = UnstructuredFileConverter()
documents = converter.run(paths = ["a/file/path.pdf", "a/directory/path"])["documents"]
```

Expand All @@ -59,7 +64,7 @@ from haystack_integrations.components.converters.unstructured import Unstructure
document_store = InMemoryDocumentStore()

indexing = Pipeline()
indexing.add_component("converter", UnstructuredFileConverter(api_key="UNSTRUCTURED_API_KEY"))
indexing.add_component("converter", UnstructuredFileConverter())
indexing.add_component("writer", DocumentWriter(document_store))
indexing.connect("converter", "writer")

Expand Down

0 comments on commit eba53a9

Please sign in to comment.