venkat-srinivasan-nexusflow commited on
Commit
5e35ce5
·
verified ·
1 Parent(s): 70b6113

Update example/vllm_v2_weather_agent.py

Browse files
Files changed (1) hide show
  1. example/vllm_v2_weather_agent.py +10 -10
example/vllm_v2_weather_agent.py CHANGED
@@ -7,35 +7,35 @@ EXAMPLE OUTPUT:
7
 
8
  ****************************************
9
  RUNNING QUERY: What's the weather for Paris, TX in fahrenheit?
10
- Turn 1
11
  ----------------------------------------
12
 
13
  Executing: get_geo_coordinates
14
  Arguments: {'city': 'Paris', 'state': 'TX'}
15
  Response: The coordinates for Paris, TX are: latitude 33.6609, longitude 95.5555
16
 
17
- Turn 2
18
  ----------------------------------------
19
 
20
  Executing: get_current_weather
21
  Arguments: {'latitude': [33.6609], 'longitude': [95.5555], 'unit': 'fahrenheit'}
22
  Response: The weather is 85 degrees fahrenheit. It is partly cloudy, with highs in the 90's.
23
 
24
- Turn 3
25
  ----------------------------------------
26
  Conversation Complete
27
 
28
 
29
  ****************************************
30
  RUNNING QUERY: Who won the most recent PGA?
31
- Turn 1
32
  ----------------------------------------
33
 
34
  Executing: no_relevant_function
35
  Arguments: {'user_query_span': 'Who won the most recent PGA?'}
36
  Response: No relevant function for your request was found. We will stop here.
37
 
38
- Turn 2
39
  ----------------------------------------
40
  Conversation Complete
41
  """
@@ -46,7 +46,7 @@ class WeatherConfig:
46
  api_key: str = "" # FILL IN WITH YOUR VLLM_ENDPOINT_KEY
47
  api_base: str = "" # FILL IN WITH YOUR VLLM_ENDPOINT
48
  model: Optional[str] = None
49
- max_turns: int = 5
50
 
51
  class WeatherTools:
52
  """Collection of available tools/functions for the weather agent"""
@@ -192,8 +192,8 @@ class WeatherAgent:
192
  print ("*" * 40)
193
  print (f"RUNNING QUERY: {initial_query}")
194
 
195
- for turn in range(self.config.max_turns):
196
- print(f"\nTurn {turn + 1}")
197
  print("-" * 40)
198
 
199
  response = self.client.chat.completions.create(
@@ -217,8 +217,8 @@ class WeatherAgent:
217
 
218
  self.process_tool_calls(message)
219
 
220
- if turn >= self.config.max_turns - 1:
221
- print("Maximum turns reached")
222
 
223
  def main():
224
  # Example usage
 
7
 
8
  ****************************************
9
  RUNNING QUERY: What's the weather for Paris, TX in fahrenheit?
10
+ Step 1
11
  ----------------------------------------
12
 
13
  Executing: get_geo_coordinates
14
  Arguments: {'city': 'Paris', 'state': 'TX'}
15
  Response: The coordinates for Paris, TX are: latitude 33.6609, longitude 95.5555
16
 
17
+ Step 2
18
  ----------------------------------------
19
 
20
  Executing: get_current_weather
21
  Arguments: {'latitude': [33.6609], 'longitude': [95.5555], 'unit': 'fahrenheit'}
22
  Response: The weather is 85 degrees fahrenheit. It is partly cloudy, with highs in the 90's.
23
 
24
+ Step 3
25
  ----------------------------------------
26
  Conversation Complete
27
 
28
 
29
  ****************************************
30
  RUNNING QUERY: Who won the most recent PGA?
31
+ Step 1
32
  ----------------------------------------
33
 
34
  Executing: no_relevant_function
35
  Arguments: {'user_query_span': 'Who won the most recent PGA?'}
36
  Response: No relevant function for your request was found. We will stop here.
37
 
38
+ Step 2
39
  ----------------------------------------
40
  Conversation Complete
41
  """
 
46
  api_key: str = "" # FILL IN WITH YOUR VLLM_ENDPOINT_KEY
47
  api_base: str = "" # FILL IN WITH YOUR VLLM_ENDPOINT
48
  model: Optional[str] = None
49
+ max_steps: int = 5
50
 
51
  class WeatherTools:
52
  """Collection of available tools/functions for the weather agent"""
 
192
  print ("*" * 40)
193
  print (f"RUNNING QUERY: {initial_query}")
194
 
195
+ for step in range(self.config.max_steps):
196
+ print(f"\nStep {step + 1}")
197
  print("-" * 40)
198
 
199
  response = self.client.chat.completions.create(
 
217
 
218
  self.process_tool_calls(message)
219
 
220
+ if step >= self.config.max_steps - 1:
221
+ print("Maximum steps reached")
222
 
223
  def main():
224
  # Example usage