Diego Carpintero commited on
Commit
202ed7a
1 Parent(s): f157f1c

add termination condition for NO_TEXT_FOUND

Browse files
config/agents.yaml CHANGED
@@ -5,6 +5,7 @@ ocr_agent:
5
  2. Clean and format the extracted text
6
  3. Do not perform any analysis on the extracted text
7
  4. Reply with the extracted text
 
8
 
9
  link_checker_agent:
10
  assignment: >
 
5
  2. Clean and format the extracted text
6
  3. Do not perform any analysis on the extracted text
7
  4. Reply with the extracted text
8
+ 5. If there is no text in the image, reply with "NO_TEXT_FOUND"
9
 
10
  link_checker_agent:
11
  assignment: >
examples/06.landscape.ham.png ADDED
examples/log.csv CHANGED
@@ -4,3 +4,4 @@ input_image
4
  03.en.billing.sms.png
5
  04.en.multifactor.email.png
6
  05.en.twitter.png
 
 
4
  03.en.billing.sms.png
5
  04.en.multifactor.email.png
6
  05.en.twitter.png
7
+ 06.landscape.ham.png
minerva.py CHANGED
@@ -2,11 +2,13 @@ from typing import List, AsyncIterator
2
  import os
3
 
4
  from autogen_agentchat.agents import AssistantAgent
 
5
  from autogen_agentchat.messages import MultiModalMessage
6
  from autogen_agentchat.teams import RoundRobinGroupChat
7
  from autogen_core import Image as AGImage
8
  from autogen_core.tools import FunctionTool
9
  from autogen_ext.models.openai import OpenAIChatCompletionClient
 
10
  from dotenv import load_dotenv, find_dotenv
11
  from PIL import Image
12
  import yaml
@@ -107,9 +109,12 @@ class Minerva:
107
 
108
  def create_team(self) -> RoundRobinGroupChat:
109
  """Create a team of agents that work together in Round Robin fashion"""
 
 
110
  return RoundRobinGroupChat(
111
  self.agents,
112
- max_turns=6
 
113
  )
114
 
115
  async def reset(self):
 
2
  import os
3
 
4
  from autogen_agentchat.agents import AssistantAgent
5
+ from autogen_agentchat.conditions import TextMentionTermination
6
  from autogen_agentchat.messages import MultiModalMessage
7
  from autogen_agentchat.teams import RoundRobinGroupChat
8
  from autogen_core import Image as AGImage
9
  from autogen_core.tools import FunctionTool
10
  from autogen_ext.models.openai import OpenAIChatCompletionClient
11
+
12
  from dotenv import load_dotenv, find_dotenv
13
  from PIL import Image
14
  import yaml
 
109
 
110
  def create_team(self) -> RoundRobinGroupChat:
111
  """Create a team of agents that work together in Round Robin fashion"""
112
+ termination = TextMentionTermination("NO_TEXT_FOUND")
113
+
114
  return RoundRobinGroupChat(
115
  self.agents,
116
+ max_turns=6,
117
+ termination_condition=termination
118
  )
119
 
120
  async def reset(self):