File size: 831 Bytes
01aa6b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from langchain_google_genai import ChatGoogleGenerativeAI

class GoogleModel:
    def __init__(
        self,
        model: str = "gemini-2.0-flash",
        temperature: int = 0.2,
        tools: list = None,
    ):  
        """Initialize the GoogleModel with the specified model name and temperature.
        """
        
        if tools:
            self.llm = ChatGoogleGenerativeAI(
                model=model,
                temperature=temperature,
                max_tokens=None,
                timeout=None,
                max_retries=1,
            ).bind_tools(tools=tools)
        else:
            self.llm = ChatGoogleGenerativeAI(
                model=model,
                temperature=temperature,
                max_tokens=None,
                timeout=None,
                max_retries=1,
            )