Add files via upload

This commit is contained in:
FatihMakes authored and GitHub committed 2026-09-16 18:48:54 +03:00
1 parent b3f7708e0e
commit 476a9c09d6
28 files changed
+8099 -2459

No files matched your search

+10 -5
View File
@@ -25,19 +25,24 @@ import tempfile
from pathlib import Path
from datetime import datetime
# Model choice, timeout and fallback ladder all live in core/gemini.py.
from core import gemini
def _get_api_key() -> str:
config_path = Path(__file__).resolve().parent.parent / "config" / "api_keys.json"
with open(config_path, "r", encoding="utf-8") as f:
return json.load(f)["gemini_api_key"]
def _gemini_client():
from google import genai
_c = genai.Client(api_key=_get_api_key())
def _gemini_client(tier: str = gemini.SMART):
"""Summarising documents and reading images — the reasoning tier, with a
long deadline because the input can be a whole file."""
class _W:
def generate_content(self, contents):
return _c.models.generate_content(model="gemini-flash-latest", contents=contents)
resp = gemini.call(contents, tier=tier, timeout_ms=90000)
if resp is None:
raise RuntimeError("every Gemini model on the ladder failed")
return resp
return _W()