Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] : Add support for azure search service #139

Open
sharmaamanwai opened this issue Nov 29, 2024 · 1 comment
Open

[Feature Request] : Add support for azure search service #139

sharmaamanwai opened this issue Nov 29, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@sharmaamanwai
Copy link

Hello guys i am new to python i am using prompty, can we add additional datasource in the prompty file
Below is the example i can found on microsoft docs
https://learn.microsoft.com/en-us/azure/ai-services/openai/references/azure-search?tabs=python#examples

import os
from openai import AzureOpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider

endpoint = os.environ.get("AzureOpenAIEndpoint")
deployment = os.environ.get("ChatCompletionsDeploymentName")
search_endpoint = os.environ.get("SearchEndpoint")
search_index = os.environ.get("SearchIndex")

token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default")

client = AzureOpenAI(
    azure_endpoint=endpoint,
    azure_ad_token_provider=token_provider,
    api_version="2024-02-01",
)

completion = client.chat.completions.create(
    model=deployment,
    messages=[
        {
            "role": "user",
            "content": "Who is DRI?",
        },
    ],
    extra_body={
        "data_sources": [
            {
                "type": "azure_search",
                "parameters": {
                    "endpoint": search_endpoint,
                    "index_name": search_index,
                    "authentication": {
                        "type": "system_assigned_managed_identity"
                    }
                }
            }
        ]
    }
)

print(completion.model_dump_json(indent=2))
@sharmaamanwai sharmaamanwai changed the title Add support for azure search service [Feature Request] : Add support for azure search service Nov 29, 2024
@BethanyJep
Copy link
Contributor

Hello,

Here is an example of the implementation of Azure AI Search, -> create_website_copy_request

@BethanyJep BethanyJep added the documentation Improvements or additions to documentation label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants