helloparthshah commited on
Commit
657847e
·
1 Parent(s): 979f76c

updated costs

Browse files
src/manager/agent_manager.py CHANGED
@@ -111,6 +111,7 @@ class GeminiAgent(Agent):
111
 
112
  # Initialize the Gemini API
113
  self.client = genai.Client(api_key=self.api_key)
 
114
 
115
  # Call parent constructor after API setup
116
  super().__init__(agent_name,
@@ -125,9 +126,8 @@ class GeminiAgent(Agent):
125
  self.messages = []
126
 
127
  def ask_agent(self, prompt):
128
- response = self.client.models.generate_content(
129
- model=self.base_model,
130
- contents=prompt,
131
  config=types.GenerateContentConfig(
132
  system_instruction=self.system_prompt,
133
  )
@@ -369,7 +369,7 @@ class AgentManager():
369
  if not self.is_cloud_invocation_enabled and agent.get_type() == "cloud":
370
  raise ValueError("Cloud invocation mode is disabled.")
371
 
372
- n_tokens = len(prompt.split())/1000
373
 
374
  self.validate_budget(agent.invoke_resource_cost,
375
  agent.invoke_expense_cost*n_tokens)
 
111
 
112
  # Initialize the Gemini API
113
  self.client = genai.Client(api_key=self.api_key)
114
+ self.chat = self.client.chats.create(model=base_model)
115
 
116
  # Call parent constructor after API setup
117
  super().__init__(agent_name,
 
126
  self.messages = []
127
 
128
  def ask_agent(self, prompt):
129
+ response = self.chat.send_message(
130
+ message=prompt,
 
131
  config=types.GenerateContentConfig(
132
  system_instruction=self.system_prompt,
133
  )
 
369
  if not self.is_cloud_invocation_enabled and agent.get_type() == "cloud":
370
  raise ValueError("Cloud invocation mode is disabled.")
371
 
372
+ n_tokens = len(prompt.split())/1000000
373
 
374
  self.validate_budget(agent.invoke_resource_cost,
375
  agent.invoke_expense_cost*n_tokens)
src/tools/default_tools/agent_cost_manager.py CHANGED
@@ -32,43 +32,43 @@ class AgentCostManager():
32
  },
33
  "gemini-2.5-flash-preview-04-17": {
34
  "description": "Adaptive thinking, cost efficiency",
35
- "create_expense_cost": 0.005,
36
- "invoke_expense_cost": 0.00017
37
  },
38
- "gemini-2.5-pro-preview-03-25": {
39
  "description": "Enhanced thinking and reasoning, multimodal understanding, advanced coding, and more",
40
- "create_expense_cost": 0.005,
41
- "invoke_expense_cost": 0.0001275
42
  },
43
  "gemini-2.0-flash": {
44
- "description": "Next generation features, speed, thinking, realtime streaming, and multimodal generation",
45
- "create_expense_cost": 0.005,
46
- "invoke_expense_cost": 0.00017
47
  },
48
  "gemini-2.0-flash-lite": {
49
  "description": "Cost efficiency and low latency",
50
- "create_expense_cost": 0.005,
51
- "invoke_expense_cost": 0.00017
52
  },
53
  "gemini-1.5-flash": {
54
  "description": "Fast and versatile performance across a diverse variety of tasks",
55
- "create_expense_cost": 0.005,
56
- "invoke_expense_cost": 0.00017
57
  },
58
  "gemini-1.5-flash-8b": {
59
  "description": "High volume and lower intelligence tasks",
60
- "create_expense_cost": 0.005,
61
- "invoke_expense_cost": 0.00017
62
  },
63
  "gemini-1.5-pro": {
64
  "description": "Complex reasoning tasks requiring more intelligence",
65
- "create_expense_cost": 0.005,
66
- "invoke_expense_cost": 0.0001275
67
  },
68
  "gemini-2.0-flash-live-001": {
69
  "description": "Low-latency bidirectional voice and video interactions",
70
- "create_expense_cost": 0.005,
71
- "invoke_expense_cost": 0.000635
72
  }
73
  }
74
 
 
32
  },
33
  "gemini-2.5-flash-preview-04-17": {
34
  "description": "Adaptive thinking, cost efficiency",
35
+ "create_expense_cost": 0,
36
+ "invoke_expense_cost": 0.15,
37
  },
38
+ "gemini-2.5-pro-preview-05-06": {
39
  "description": "Enhanced thinking and reasoning, multimodal understanding, advanced coding, and more",
40
+ "create_expense_cost": 0,
41
+ "invoke_expense_cost": 1.25,
42
  },
43
  "gemini-2.0-flash": {
44
+ "description": "Next generation features, speed.",
45
+ "create_expense_cost": 0,
46
+ "invoke_expense_cost": 0.10,
47
  },
48
  "gemini-2.0-flash-lite": {
49
  "description": "Cost efficiency and low latency",
50
+ "create_expense_cost": 0,
51
+ "invoke_expense_cost": 0.075
52
  },
53
  "gemini-1.5-flash": {
54
  "description": "Fast and versatile performance across a diverse variety of tasks",
55
+ "create_expense_cost": 0,
56
+ "invoke_expense_cost": 0.075,
57
  },
58
  "gemini-1.5-flash-8b": {
59
  "description": "High volume and lower intelligence tasks",
60
+ "create_expense_cost": 0,
61
+ "invoke_expense_cost": 0.0375,
62
  },
63
  "gemini-1.5-pro": {
64
  "description": "Complex reasoning tasks requiring more intelligence",
65
+ "create_expense_cost": 0,
66
+ "invoke_expense_cost": 1.25,
67
  },
68
  "gemini-2.0-flash-live-001": {
69
  "description": "Low-latency bidirectional voice and video interactions",
70
+ "create_expense_cost": 0,
71
+ "invoke_expense_cost": 0.50,
72
  }
73
  }
74