Skip to content

Commit 88c9d2b

Browse files
Merge pull request #272976 from kristapratico/patch-1
Update use-your-data-python.md
2 parents 5d0c6f0 + ad5ada0 commit 88c9d2b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

articles/ai-services/openai/includes/use-your-data-python.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ api_key = os.environ.get("AZURE_OPENAI_API_KEY")
5757
deployment = os.environ.get("AZURE_OPENAI_DEPLOYMENT_ID")
5858

5959
client = openai.AzureOpenAI(
60-
base_url=f"{endpoint}/openai/deployments/{deployment}/extensions",
60+
azure_endpoint=endpoint,
6161
api_key=api_key,
62-
api_version="2023-08-01-preview",
62+
api_version="2024-02-01",
6363
)
6464

6565
completion = client.chat.completions.create(
@@ -71,16 +71,19 @@ completion = client.chat.completions.create(
7171
},
7272
],
7373
extra_body={
74-
"dataSources": [
74+
"data_sources":[
7575
{
76-
"type": "AzureCognitiveSearch",
76+
"type": "azure_search",
7777
"parameters": {
7878
"endpoint": os.environ["AZURE_AI_SEARCH_ENDPOINT"],
79-
"key": os.environ["AZURE_AI_SEARCH_API_KEY"],
80-
"indexName": os.environ["AZURE_AI_SEARCH_INDEX"]
79+
"index_name": os.environ["AZURE_AI_SEARCH_INDEX"],
80+
"authentication": {
81+
"type": "api_key",
82+
"key": os.environ["AZURE_AI_SEARCH_API_KEY"],
83+
}
8184
}
8285
}
83-
]
86+
],
8487
}
8588
)
8689

@@ -162,4 +165,4 @@ python main.py
162165
The application prints the response in a JSON format suitable for use in many scenarios. It includes both answers to your query and citations from your uploaded files.
163166

164167
> [!div class="nextstepaction"]
165-
> [I ran into an issue when running the code samples.](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=dotnet&Pillar=AOAI&Product=ownData&Page=quickstart&Section=Create-dotnet-application)
168+
> [I ran into an issue when running the code samples.](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=dotnet&Pillar=AOAI&Product=ownData&Page=quickstart&Section=Create-dotnet-application)

0 commit comments

Comments
 (0)