camel.messages.conversion.sharegpt.hermes package#
Submodules#
camel.messages.conversion.sharegpt.hermes.hermes_function_formatter module#
- class camel.messages.conversion.sharegpt.hermes.hermes_function_formatter.HermesFunctionFormatter[source]#
Bases:
FunctionCallFormatter
[HermesToolCall
,HermesToolResponse
]Hermes-style function calling format implementation with validation
- extract_tool_calls(message: str) → List[HermesToolCall][source]#
Extracts all tool calls from the provided message string.
- Parameters:
message (str) β The input message string containing potential tool calls.
- Returns:
A list of parsed HermesToolCall objects.
- Return type:
List[HermesToolCall]
- extract_tool_response(message: str) → HermesToolResponse | None[source]#
Extracts a single tool response from the provided message string.
- Parameters:
message (str) β The input message string containing a potential tool response.
- Returns:
- A parsed HermesToolResponse object,
or None if no valid response is found.
- Return type:
Optional[HermesToolResponse]
- format_tool_call(content: str, func_name: str, args: Dict[str, Any]) → str[source]#
Formats a tool call message with the given content, function name, and arguments.
- Parameters:
content (str) β The content or message to be included in the tool call.
func_name (str) β The name of the function being called.
args (Dict[str, Any]) β A dictionary of arguments to be passed to the function.
- Returns:
- A formatted string representing the tool call in Hermes
format.
- Return type:
str
- format_tool_response(func_name: str, result: Any) → str[source]#
Formats a tool response message with the given function name and result.
- Parameters:
func_name (str) β The name of the function whose result is being returned.
result (Any) β The result to be included in the tool response.
- Returns:
- A formatted string representing the tool response in Hermes
format.
- Return type:
str
- class camel.messages.conversion.sharegpt.hermes.hermes_function_formatter.HermesToolCall(*, name: str, arguments: Dict[str, Any])[source]#
Bases:
ToolCall
Represents a single tool/function call with validation
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'json_schema_extra': {'examples': [{'arguments': {'city': 'London', 'units': 'celsius'}, 'name': 'get_weather'}]}}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class camel.messages.conversion.sharegpt.hermes.hermes_function_formatter.HermesToolResponse(*, name: str, content: Any)[source]#
Bases:
ToolResponse
Represents a single tool/function call with validation
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'json_schema_extra': {'examples': [{'content': {'conditions': 'sunny', 'humidity': 65, 'temperature': 20}, 'name': 'get_weather'}]}}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Module contents#
- class camel.messages.conversion.sharegpt.hermes.HermesFunctionFormatter[source]#
Bases:
FunctionCallFormatter
[HermesToolCall
,HermesToolResponse
]Hermes-style function calling format implementation with validation
- extract_tool_calls(message: str) → List[HermesToolCall][source]#
Extracts all tool calls from the provided message string.
- Parameters:
message (str) β The input message string containing potential tool calls.
- Returns:
A list of parsed HermesToolCall objects.
- Return type:
List[HermesToolCall]
- extract_tool_response(message: str) → HermesToolResponse | None[source]#
Extracts a single tool response from the provided message string.
- Parameters:
message (str) β The input message string containing a potential tool response.
- Returns:
- A parsed HermesToolResponse object,
or None if no valid response is found.
- Return type:
Optional[HermesToolResponse]
- format_tool_call(content: str, func_name: str, args: Dict[str, Any]) → str[source]#
Formats a tool call message with the given content, function name, and arguments.
- Parameters:
content (str) β The content or message to be included in the tool call.
func_name (str) β The name of the function being called.
args (Dict[str, Any]) β A dictionary of arguments to be passed to the function.
- Returns:
- A formatted string representing the tool call in Hermes
format.
- Return type:
str
- format_tool_response(func_name: str, result: Any) → str[source]#
Formats a tool response message with the given function name and result.
- Parameters:
func_name (str) β The name of the function whose result is being returned.
result (Any) β The result to be included in the tool response.
- Returns:
- A formatted string representing the tool response in Hermes
format.
- Return type:
str