Scott Cogan commited on
Commit
dd52cf5
·
1 Parent(s): 0ccb77a

requirements update for llm compat

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -310,12 +310,11 @@ class BasicAgent:
310
  else:
311
  messages_with_system = [self.sys_msg] + messages
312
 
313
- # Define tools in Gemini's format
314
  tools = [{
315
  "name": "google_search",
316
  "description": "Search for information on the web",
317
  "parameters": {
318
- "type": "object",
319
  "properties": {
320
  "query": {
321
  "type": "string",
@@ -326,9 +325,26 @@ class BasicAgent:
326
  }
327
  }]
328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  response = self.primary_llm.invoke(
330
  messages_with_system,
331
- tools=tools
332
  )
333
  except Exception as e:
334
  error_str = str(e)
 
310
  else:
311
  messages_with_system = [self.sys_msg] + messages
312
 
313
+ # Define tools in Gemini's native format
314
  tools = [{
315
  "name": "google_search",
316
  "description": "Search for information on the web",
317
  "parameters": {
 
318
  "properties": {
319
  "query": {
320
  "type": "string",
 
325
  }
326
  }]
327
 
328
+ # Create a GenAI tool object
329
+ genai_tool = GenAITool(
330
+ function_declarations=[{
331
+ "name": "google_search",
332
+ "description": "Search for information on the web",
333
+ "parameters": {
334
+ "properties": {
335
+ "query": {
336
+ "type": "string",
337
+ "description": "The search query"
338
+ }
339
+ },
340
+ "required": ["query"]
341
+ }
342
+ }]
343
+ )
344
+
345
  response = self.primary_llm.invoke(
346
  messages_with_system,
347
+ tools=[genai_tool]
348
  )
349
  except Exception as e:
350
  error_str = str(e)