magnustragardh commited on
Commit
6f24b2c
·
1 Parent(s): dcdf6ae

- Remove non-functioning rate limiting.

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -48,11 +48,7 @@ class BasicAgent:
48
  question.blocks[0].text
49
  print(f"Agent received question (first 50 chars): {question.blocks[0].text[:50]}...")
50
  # Here, we need to rate limit
51
- handler = self._agent.run(user_msg=question)
52
- async for event in handler.stream_events():
53
- if isinstance(event, AgentOutput):
54
- await asyncio.sleep(self._min_call_interval)
55
- agent_output = await handler
56
  print(f"Agent returning answer: {agent_output}")
57
  response_parts = str(agent_output).split('FINAL ANSWER: ')
58
  if len(response_parts) > 1:
@@ -88,6 +84,8 @@ def get_media_content(item):
88
  media_type = get_media_type(item.get('file_name'))
89
  if media_type == 'image':
90
  return ImageBlock(image=file_response.content)
 
 
91
  # Audio currently not supported
92
  #elif media_type == 'audio':
93
  # return AudioBlock(audio=file_response.content)
 
48
  question.blocks[0].text
49
  print(f"Agent received question (first 50 chars): {question.blocks[0].text[:50]}...")
50
  # Here, we need to rate limit
51
+ agent_output = await self._agent.run(user_msg=question)
 
 
 
 
52
  print(f"Agent returning answer: {agent_output}")
53
  response_parts = str(agent_output).split('FINAL ANSWER: ')
54
  if len(response_parts) > 1:
 
84
  media_type = get_media_type(item.get('file_name'))
85
  if media_type == 'image':
86
  return ImageBlock(image=file_response.content)
87
+ elif media_type == 'text':
88
+ return TextBlock(text=file_response.content)
89
  # Audio currently not supported
90
  #elif media_type == 'audio':
91
  # return AudioBlock(audio=file_response.content)