Skip to content

Commit

Permalink
Update code snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannikolaidis authored Apr 18, 2024
1 parent 7130b17 commit 4a1d5ec
Show file tree
Hide file tree
Showing 144 changed files with 231 additions and 142 deletions.
58 changes: 58 additions & 0 deletions snippets/destination_connectors/astra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
```
import os

from unstructured.ingest.connector.astra import (
AstraAccessConfig,
AstraWriteConfig,
SimpleAstraConfig,
)
from unstructured.ingest.connector.local import SimpleLocalConfig
from unstructured.ingest.interfaces import (
ChunkingConfig,
EmbeddingConfig,
PartitionConfig,
ProcessorConfig,
ReadConfig,
)
from unstructured.ingest.runner import LocalRunner
from unstructured.ingest.runner.writers.astra import (
AstraWriter,
)
from unstructured.ingest.runner.writers.base_writer import Writer


def get_writer() -> Writer:
return AstraWriter(
connector_config=SimpleAstraConfig(
access_config=AstraAccessConfig(
token=os.getenv("ASTRA_DB_TOKEN"), api_endpoint=os.getenv("ASTRA_DB_ENDPOINT")
),
collection_name="test_collection",
embedding_dimension=384,
),
write_config=AstraWriteConfig(batch_size=80),
)


if __name__ == "__main__":
writer = get_writer()
runner = LocalRunner(
processor_config=ProcessorConfig(
verbose=True,
output_dir="local-output-to-astra",
num_processes=2,
),
connector_config=SimpleLocalConfig(
input_path="example-docs/book-war-and-peace-1p.txt",
),
read_config=ReadConfig(),
partition_config=PartitionConfig(),
chunking_config=ChunkingConfig(chunk_elements=True),
embedding_config=EmbeddingConfig(
provider="langchain-huggingface",
),
writer=writer,
writer_kwargs={},
)
runner.run()
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
from unstructured.ingest.connector.fsspec.azure import (
AzureAccessConfig,
AzureWriteConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.azure_cognitive_search import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.fsspec.box import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
from unstructured.ingest.connector.chroma import (
ChromaAccessConfig,
ChromaWriteConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
from unstructured.ingest.connector.clarifai import (
ClarifaiAccessConfig,
ClarifaiWriteConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.databricks_volumes import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.delta_table import DeltaTableWriteConfig, SimpleDeltaTableConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.fsspec.dropbox import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.elasticsearch import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.fsspec.gcs import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.local import SimpleLocalConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.elasticsearch import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.local import SimpleLocalConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
from unstructured.ingest.connector.local import SimpleLocalConfig
from unstructured.ingest.connector.qdrant import (
QdrantWriteConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
from unstructured.ingest.connector.fsspec.s3 import S3AccessConfig, S3WriteConfig, SimpleS3Config
from unstructured.ingest.connector.local import SimpleLocalConfig
from unstructured.ingest.interfaces import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.interfaces import PartitionConfig, ProcessorConfig, ReadConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.local import SimpleLocalConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
from unstructured.ingest.connector.local import SimpleLocalConfig
from unstructured.ingest.connector.weaviate import (
SimpleWeaviateConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.airtable import AirtableAccessConfig, SimpleAirtableConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.airtable import AirtableAccessConfig, SimpleAirtableConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
from unstructured.ingest.connector.fsspec.azure import (
AzureAccessConfig,
SimpleAzureBlobStorageConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.fsspec.azure import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
from unstructured.ingest.connector.biomed import (
SimpleBiomedConfig,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.biomed import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash
unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.fsspec.box import BoxAccessConfig, SimpleBoxConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash

unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.fsspec.box import BoxAccessConfig, SimpleBoxConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash

unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
from unstructured.ingest.connector.confluence import ConfluenceAccessConfig, SimpleConfluenceConfig
from unstructured.ingest.interfaces import PartitionConfig, ProcessorConfig, ReadConfig
from unstructured.ingest.runner import ConfluenceRunner
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```bash
```
#!/usr/bin/env bash

unstructured-ingest \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
```python
```
import os

from unstructured.ingest.connector.confluence import ConfluenceAccessConfig, SimpleConfluenceConfig
Expand Down
Loading

0 comments on commit 4a1d5ec

Please sign in to comment.