Skip to content

Commit

Permalink
Merge branch 'main' into adopt-secret-unstructured
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsbatista authored Feb 20, 2024
2 parents 4ac9c5f + b7e2f00 commit 4b81ef7
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 172 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI_readme_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
for d in $ALL_CHANGED_DIRS; do
cd $d
hatch run docs
hatch env prune # clean up the environment after docs generation
cd -
done
mkdir tmp
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/astra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ jobs:

- name: Run tests
env:
ASTRA_API_ENDPOINT: ${{ secrets.ASTRA_API_ENDPOINT }}
ASTRA_TOKEN: ${{ secrets.ASTRA_TOKEN }}
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_API_ENDPOINT }}
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_TOKEN }}
run: hatch run cov
23 changes: 8 additions & 15 deletions integrations/astra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pyenv local 3.9
Local install for the package
`pip install -e .`
To execute integration tests, add needed environment variables
`ASTRA_DB_ID=<id>`
`ASTRA_DB_API_ENDPOINT=<id>`
`ASTRA_DB_APPLICATION_TOKEN=<token>`
and execute
`python examples/example.py`
Expand All @@ -27,12 +27,10 @@ Install requirements

Export environment variables
```
export KEYSPACE_NAME=
export ASTRA_DB_API_ENDPOINT=
export ASTRA_DB_APPLICATION_TOKEN=
export COLLECTION_NAME=
export OPENAI_API_KEY=
export ASTRA_DB_ID=
export ASTRA_DB_REGION=
export ASTRA_DB_APPLICATION_TOKEN=
```

run the python examples
Expand All @@ -54,22 +52,17 @@ from haystack.preview.document_stores import DuplicatePolicy

Load in environment variables:
```
astra_id = os.getenv("ASTRA_DB_ID", "")
astra_region = os.getenv("ASTRA_DB_REGION", "us-east1")
astra_application_token = os.getenv("ASTRA_DB_APPLICATION_TOKEN", "")
api_endpoint = os.getenv("ASTRA_DB_API_ENDPOINT", "")
token = os.getenv("ASTRA_DB_APPLICATION_TOKEN", "")
collection_name = os.getenv("COLLECTION_NAME", "haystack_vector_search")
keyspace_name = os.getenv("KEYSPACE_NAME", "recommender_demo")
```

Create the Document Store object:
```
document_store = AstraDocumentStore(
astra_id=astra_id,
astra_region=astra_region,
astra_collection=collection_name,
astra_keyspace=keyspace_name,
astra_application_token=astra_application_token,
api_endpoint=api_endpoint,
token=token,
collection_name=collection_name,
duplicates_policy=DuplicatePolicy.SKIP,
embedding_dim=384,
)
Expand Down
2 changes: 2 additions & 0 deletions integrations/astra/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies = [
"haystack-ai",
"pydantic",
"typing_extensions",
"astrapy",
]

[project.urls]
Expand Down Expand Up @@ -185,6 +186,7 @@ markers = [
[[tool.mypy.overrides]]
module = [
"astra_client.*",
"astrapy.*",
"pydantic.*",
"haystack.*",
"haystack_integrations.*",
Expand Down
Loading

0 comments on commit 4b81ef7

Please sign in to comment.