|
80 | 80 | "client = AzureOpenAI(\n", |
81 | 81 | " azure_endpoint=config_details[\"AZURE_OPENAI_ENDPOINT\"], # The base URL for your Azure OpenAI resource. e.g. \"https://<your resource name>.openai.azure.com\"\n", |
82 | 82 | " api_key=os.getenv(\"AZURE_OPENAI_KEY\"), # The API key for your Azure OpenAI resource.\n", |
83 | | - " api_version=\"2023-12-01-preview\", # This version supports function calling\n", |
84 | | - ")" |
| 83 | + " api_version=config_details[\"OPENAI_API_VERSION\"], # This version supports function calling\n", |
| 84 | + ")\n", |
| 85 | + "\n", |
| 86 | + "model_name = config_details[\"MODEL_NAME\"]" |
85 | 87 | ] |
86 | 88 | }, |
87 | 89 | { |
|
293 | 295 | "]\n", |
294 | 296 | "\n", |
295 | 297 | "response = client.chat.completions.create(\n", |
296 | | - " model=\"gpt-35-turbo\",\n", |
| 298 | + " model=model_name,\n", |
297 | 299 | " messages=messages,\n", |
298 | 300 | " tools=tools,\n", |
299 | 301 | " temperature=0.2,\n", |
|
362 | 364 | "\n", |
363 | 365 | " # Step 1: send the conversation and available functions to GPT\n", |
364 | 366 | " response = client.chat.completions.create(\n", |
365 | | - " model=\"gpt-35-turbo\",\n", |
| 367 | + " model=model_name,\n", |
366 | 368 | " messages=messages,\n", |
367 | 369 | " tools=tools,\n", |
368 | 370 | " tool_choice=\"auto\",\n", |
|
422 | 424 | "\n", |
423 | 425 | " second_response = client.chat.completions.create(\n", |
424 | 426 | " messages=messages,\n", |
425 | | - " model=\"gpt-35-turbo\",\n", |
| 427 | + " model=model_name,\n", |
426 | 428 | " ) # get a new response from GPT where it can see the function response\n", |
427 | 429 | "\n", |
428 | 430 | " return second_response\n", |
|
0 commit comments