randydev commited on
Commit
8e64de4
1 Parent(s): b461416

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -1
main.py CHANGED
@@ -529,6 +529,7 @@ def free_chatgpt4_bing(query: str):
529
  def google_ai(query: str, api_key: None = Depends(validate_api_key)):
530
  url = SOURCE_ASSISTANT_GOOGLE_AI
531
  token = ASSISTANT_GOOGLE_API_KEYS
 
532
  try:
533
  headers = {"Content-Type": "application/json"}
534
  data = {
@@ -536,7 +537,7 @@ def google_ai(query: str, api_key: None = Depends(validate_api_key)):
536
  "text": query
537
  }
538
  }
539
- response = requests.post(f"{url}/v1beta3/models/text-bison-001:generateText?key={token}", headers=headers, json=data)
540
  response_str = response.json()
541
  answer = response_str["candidates"]
542
  for results in answer:
 
529
  def google_ai(query: str, api_key: None = Depends(validate_api_key)):
530
  url = SOURCE_ASSISTANT_GOOGLE_AI
531
  token = ASSISTANT_GOOGLE_API_KEYS
532
+ api_url = f"{SOURCE_ASSISTANT_GOOGLE_AI}/v1beta3/models/text-bison-001:generateText?key={ASSISTANT_GOOGLE_API_KEYS}"
533
  try:
534
  headers = {"Content-Type": "application/json"}
535
  data = {
 
537
  "text": query
538
  }
539
  }
540
+ response = requests.post(api_url, headers=headers, json=data)
541
  response_str = response.json()
542
  answer = response_str["candidates"]
543
  for results in answer: