Spaces:
Sleeping
Sleeping
Added env variables
Browse files- aisearch_v1.py +7 -14
aisearch_v1.py
CHANGED
|
@@ -19,20 +19,14 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
| 19 |
|
| 20 |
load_dotenv()
|
| 21 |
# GROQ_APIKEY = os.environ.get('GROQ_APIKEY')
|
| 22 |
-
GOOGS_APIKEY =
|
| 23 |
-
SEARCH_ENGINE_ID =
|
| 24 |
-
|
| 25 |
|
| 26 |
az_client = AsyncAzureOpenAI(
|
| 27 |
-
api_key='
|
| 28 |
api_version="2024-12-01-preview", # Use the appropriate API version
|
| 29 |
-
azure_endpoint=
|
| 30 |
-
)
|
| 31 |
-
|
| 32 |
-
az_client_in = AsyncAzureOpenAI(
|
| 33 |
-
api_key='CvRegNn4vwFkcAs8LPkjqeAb0qdHO88AvVxsSrnshauwP9jDm9DsJQQJ99BCAC77bzfXJ3w3AAAAACOGdbvR',
|
| 34 |
-
api_version="2024-12-01-preview", # Use the appropriate API version
|
| 35 |
-
azure_endpoint='https://docus-ai-ind954042238035.openai.azure.com'
|
| 36 |
)
|
| 37 |
|
| 38 |
class ReportResponse(BaseModel):
|
|
@@ -45,8 +39,7 @@ class ReportResponse(BaseModel):
|
|
| 45 |
|
| 46 |
|
| 47 |
# client = genai.Client(api_key=GEMINI_APIKEY)
|
| 48 |
-
gemini_client = genai.Client(api_key=
|
| 49 |
-
# gemini_client1 = genai.Client(api_key='AIzaSyBOtSrEcYlGuTZ-XZT5zJo3T_oPAWn3T2Y')
|
| 50 |
|
| 51 |
class aiSearch:
|
| 52 |
def __init__(self):
|
|
@@ -130,7 +123,7 @@ class aiSearch:
|
|
| 130 |
</output format>"""
|
| 131 |
|
| 132 |
async def gpt4omini(self,query):
|
| 133 |
-
chat_completion = await
|
| 134 |
messages=[
|
| 135 |
{
|
| 136 |
"role" : "system",
|
|
|
|
| 19 |
|
| 20 |
load_dotenv()
|
| 21 |
# GROQ_APIKEY = os.environ.get('GROQ_APIKEY')
|
| 22 |
+
GOOGS_APIKEY = os.environ.get('GOOGS_APIKEY')
|
| 23 |
+
SEARCH_ENGINE_ID = os.environ.get('SEARCH_ENGINE_ID')
|
| 24 |
+
GEMINI_APIKEY = os.environ.get('GEMINI_APIKEY')
|
| 25 |
|
| 26 |
az_client = AsyncAzureOpenAI(
|
| 27 |
+
api_key=os.environ.get('AZURE_OPENAI_API_KEY'),
|
| 28 |
api_version="2024-12-01-preview", # Use the appropriate API version
|
| 29 |
+
azure_endpoint=os.environ.get('AZURE_OPENAI_ENDPOINT')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
)
|
| 31 |
|
| 32 |
class ReportResponse(BaseModel):
|
|
|
|
| 39 |
|
| 40 |
|
| 41 |
# client = genai.Client(api_key=GEMINI_APIKEY)
|
| 42 |
+
gemini_client = genai.Client(api_key=GEMINI_APIKEY)
|
|
|
|
| 43 |
|
| 44 |
class aiSearch:
|
| 45 |
def __init__(self):
|
|
|
|
| 123 |
</output format>"""
|
| 124 |
|
| 125 |
async def gpt4omini(self,query):
|
| 126 |
+
chat_completion = await az_client.chat.completions.create(
|
| 127 |
messages=[
|
| 128 |
{
|
| 129 |
"role" : "system",
|