Conversation
ksolo
left a comment
There was a problem hiding this comment.
Looks good @rohitprasad15
Nothing blocking, just a few suggestions in the review.
| if isinstance(msg, dict): | ||
| return self._convert_dict_message(msg) | ||
| return self._convert_message_object(msg) |
There was a problem hiding this comment.
It looks like both _convert_dict_message and _convert_message_object logically do the same things. Would it be better to convert to one format and keep one of the convert message methods.
if isinstance(msg, dict):
msg = Message(msg)
return self._convert_message_object(msg)or the other way
if isinstance(msg, Message):
msg = dict(msg)
return self._convert_dict_message(msg)| tool_input = ( | ||
| tool_call["function"]["arguments"] | ||
| if isinstance(tool_call, dict) | ||
| else tool_call.function.arguments | ||
| ) | ||
| message_content.append( | ||
| { | ||
| "type": "tool_use", | ||
| "id": ( | ||
| tool_call["id"] if isinstance(tool_call, dict) else tool_call.id | ||
| ), | ||
| "name": ( | ||
| tool_call["function"]["name"] | ||
| if isinstance(tool_call, dict) | ||
| else tool_call.function.name | ||
| ), | ||
| "input": json.loads(tool_input), | ||
| } | ||
| ) |
There was a problem hiding this comment.
Similar thought, converting to either an object or dict at the beginning of this would create a consistency that would not require the if/else statements throughout the function call.
There was a problem hiding this comment.
Can you add unit tests for this?
|
@rohitprasad15 When can we expect tool calling in |
|
@ksolo - PTAL again. Added support for a bunch of other providers, and added test cases. |
Add tool calling support for below providers - OpenAI, Groq, Anthropic, AWS, & Mistral. OpenAI compatible SDKs need to changes for tool calling support. Adding utility ToolManager for users to easily supply tools, and parse model's request for tool usage.
7d4717d to
5b547b8
Compare
Add tool calling support for below providers -
OpenAI, Groq, Anthropic, AWS, & Mistral.
OpenAI compatible SDKs need to changes for
tool calling support.
Adding utility ToolManager for users to easily
supply tools, and parse model's request for
tool usage.