-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tuana/mistral' of https://github.com/deepset-ai/haystac…
…k-core-integrations into tuana/mistral
- Loading branch information
Showing
78 changed files
with
2,975 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# This workflow comes from https://github.com/ofek/hatch-mypyc | ||
# https://github.com/ofek/hatch-mypyc/blob/5a198c0ba8660494d02716cfc9d79ce4adfb1442/.github/workflows/test.yml | ||
name: Test / mongodb_atlas | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
pull_request: | ||
paths: | ||
- "integrations/mongodb_atlas/**" | ||
- ".github/workflows/mongodb_atlas.yml" | ||
|
||
defaults: | ||
run: | ||
working-directory: integrations/mongodb_atlas | ||
|
||
concurrency: | ||
group: mongodb-atlas-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PYTHONUNBUFFERED: "1" | ||
FORCE_COLOR: "1" | ||
MONGO_CONNECTION_STRING: ${{ secrets.MONGO_CONNECTION_STRING }} | ||
|
||
jobs: | ||
run: | ||
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: ['3.9', '3.10', '3.11'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Hatch | ||
run: pip install --upgrade hatch | ||
|
||
- name: Lint | ||
working-directory: integrations/mongodb_atlas | ||
if: matrix.python-version == '3.9' && runner.os == 'Linux' | ||
run: hatch run lint:all | ||
|
||
- name: Generate docs | ||
if: matrix.python-version == '3.9' && runner.os == 'Linux' | ||
run: hatch run docs | ||
|
||
- name: Run tests | ||
working-directory: integrations/mongodb_atlas | ||
run: hatch run cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from haystack import Document, Pipeline | ||
from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever | ||
from haystack.document_stores.in_memory import InMemoryDocumentStore | ||
from haystack_integrations.components.embedders.fastembed import FastembedDocumentEmbedder, FastembedTextEmbedder | ||
|
||
document_store = InMemoryDocumentStore(embedding_similarity_function="cosine") | ||
|
||
documents = [ | ||
Document(content="My name is Wolfgang and I live in Berlin"), | ||
Document(content="I saw a black horse running"), | ||
Document(content="Germany has many big cities"), | ||
Document(content="fastembed is supported by and maintained by Qdrant."), | ||
] | ||
|
||
document_embedder = FastembedDocumentEmbedder() | ||
document_embedder.warm_up() | ||
documents_with_embeddings = document_embedder.run(documents)["documents"] | ||
document_store.write_documents(documents_with_embeddings) | ||
|
||
query_pipeline = Pipeline() | ||
query_pipeline.add_component("text_embedder", FastembedTextEmbedder()) | ||
query_pipeline.add_component("retriever", InMemoryEmbeddingRetriever(document_store=document_store)) | ||
query_pipeline.connect("text_embedder.embedding", "retriever.query_embedding") | ||
|
||
query = "Who supports fastembed?" | ||
|
||
result = query_pipeline.run({"text_embedder": {"text": query}}) | ||
|
||
print(result["retriever"]["documents"][0]) # noqa: T201 | ||
|
||
# Document(id=..., | ||
# content: 'fastembed is supported by and maintained by Qdrant.', | ||
# score: 0.758..) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.