-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.py
More file actions
25 lines (20 loc) · 947 Bytes
/
search.py
File metadata and controls
25 lines (20 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import openai
# Masked variables for security purposes
penai_api_type = "azure"
openai_api_base = "https://<masked_openai_base_url>.azure.com/"
openai_api_key = "0958472e****dada" # Last few characters masked
openai_api_version = "2024-02-01"
bing_search_api_key = 'b28433f****709' # Partial masking for security
bing_search_endpoint = 'https://<masked_bing_search_url>.microsoft.com/v7.0/search'
response1 = openai.ChatCompletion.create(
engine="20hour", # engine = "deployment_name".
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},
{"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."},
{"role": "user", "content": "Do other Azure AI services support this too?"}
]
)
print(response1)
print(response1['choices'][0]['message']['content'])