search_bot / app /agent /gemini_client.py
pavan10504's picture
Upload 24 files
c7968ae verified
raw
history blame contribute delete
473 Bytes
import os
from google import genai
GEMINI_MODEL = "models/gemini-1.5-flash-001"
def get_client():
return genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
def json_generation_config(schema: dict | None = None):
config = {
"temperature": 0,
"top_p": 0.9,
"max_output_tokens": 1024,
"response_mime_type": "application/json",
}
if schema:
config["response_schema"] = schema
return config