Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions functions/models/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@

T = TypeVar("T")

FLASH_MODEL_ID = "gemini-3.6-flash"


class GeminiInvalidResponseException(Exception):
pass


def call_predict(
query="The opposite of happy is",
model="gemini-2.5-flash",
model=FLASH_MODEL_ID,
api_key: str | None = None,
) -> str:
if not api_key:
Expand All @@ -61,7 +63,7 @@ def call_predict(
def call_predict_with_image(
prompt: str,
image_bytes: bytes,
model="gemini-2.5-flash",
model=FLASH_MODEL_ID,
api_key: str | None = None,
) -> str:
"""Calls Gemini with a prompt and an image."""
Expand Down Expand Up @@ -95,7 +97,7 @@ def call_predict_with_image(
def call_predict_with_schema(
query: str,
response_schema: Type[T],
model="gemini-2.5-flash",
model=FLASH_MODEL_ID,
api_key: str | None = None,
) -> T | List[T] | None:
"""Calls Gemini with a response schema for structured output."""
Expand Down Expand Up @@ -131,7 +133,7 @@ def format_pdf_with_latex(
pdf_data: bytes,
latex_string: str,
concepts: List[LumiConcept],
model="gemini-2.5-pro",
model=FLASH_MODEL_ID,
) -> str:
"""
Calls Gemini to format the pdf, using the latex source as additional context.
Expand Down