-
Notifications
You must be signed in to change notification settings - Fork 8
Optimize chateval #44 #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
mas_arena/agents/chateval.py
Outdated
| # Handle case where response_content might be a list or other type | ||
| content = response_content if isinstance(response_content, str) else str(response_content) | ||
| if self.chat_history is None: | ||
| self.chat_history = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is unnecessary since chat_history is already initialized in the post_init method.
mas_arena/agents/chateval.py
Outdated
| "solution": response.content | ||
| } | ||
|
|
||
| async def generate_response(self, context: str) -> Any: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add specific type annotations to improve code clarity
Replace generic Any return type with more specific type annotations like
Dict[str, Union[Any, str]]
mas_arena/agents/chateval.py
Outdated
| self.chat_history.append({"role": "human", "human": context}) | ||
| self.chat_history.append({"role": "ai", "ai": content}) | ||
|
|
||
| def _build_messages(self, context: str) -> List: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add specific type annotations to improve code clarity
Replace the generic List return type with the more specific
List[Union[SystemMessage, HumanMessage, AIMessage]] to clearly indicate
the expected message types.
chateval.pyto enhance the performance.extending.mdcorrespondingly.#44