PotatoGuardAPI / llm_client.py
Liantsoaxx08's picture
add LLM for recommendation
2c67191
Raw
History Blame Contribute Delete
446 Bytes
# app/llm_client.py
from langchain_google_genai import ChatGoogleGenerativeAI
class LLMClient:
def __init__(self, model: str = "models/gemini-2.0-flash", temp: float = 0.5):
self.llm = ChatGoogleGenerativeAI(
model=model,
google_api_key= "AIzaSyAmpT2kjqFcz7HZyiFeh6dBOu-zx_MRxIA",
temperature=temp
)
def invoke(self, prompt: str) -> str:
return self.llm.invoke(prompt).content