Skip to content

Commit

Permalink
Add instructions to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Amnah199 committed Oct 25, 2024
1 parent 485960b commit 89ff7aa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions integrations/azure_ai_search/example/document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

from haystack_integrations.document_stores.azure_ai_search import AzureAISearchDocumentStore

"""
This example demonstrates how to use the AzureAISearchDocumentStore to write and filter documents.
To run this example, you'll need an Azure Search service endpoint and API key, which can either be
set as environment variables (AZURE_SEARCH_SERVICE_ENDPOINT and AZURE_SEARCH_API_KEY) or
provided directly to AzureAISearchDocumentStore(as params "api_key", "azure_endpoint").
Otherwise you can use DefaultAzureCredential to authenticate with Azure services.
See more details at https://learn.microsoft.com/en-us/azure/search/keyless-connections?tabs=python%2Cazure-cli
"""
document_store = AzureAISearchDocumentStore(
metadata_fields={"version": float, "label": str},
index_name="document-store-example",
Expand Down
9 changes: 9 additions & 0 deletions integrations/azure_ai_search/example/embedding_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
from haystack_integrations.components.retrievers.azure_ai_search import AzureAISearchEmbeddingRetriever
from haystack_integrations.document_stores.azure_ai_search import AzureAISearchDocumentStore

"""
This example demonstrates how to use the AzureAISearchEmbeddingRetriever to retrieve documents based on a query.
To run this example, you'll need an Azure Search service endpoint and API key, which can either be
set as environment variables (AZURE_SEARCH_SERVICE_ENDPOINT and AZURE_SEARCH_API_KEY) or
provided directly to AzureAISearchDocumentStore(as params "api_key", "azure_endpoint").
Otherwise you can use DefaultAzureCredential to authenticate with Azure services.
See more details at https://learn.microsoft.com/en-us/azure/search/keyless-connections?tabs=python%2Cazure-cli
"""

document_store = AzureAISearchDocumentStore()

model = "sentence-transformers/all-mpnet-base-v2"
Expand Down
2 changes: 1 addition & 1 deletion integrations/azure_ai_search/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from haystack_integrations.document_stores.azure_ai_search import AzureAISearchDocumentStore

# This is the approximate time in seconds it takes for the documents to be available in Azure Search index
SLEEP_TIME_IN_SECONDS = 5
SLEEP_TIME_IN_SECONDS = 10


@pytest.fixture()
Expand Down

0 comments on commit 89ff7aa

Please sign in to comment.