Data Collector
Camel.data collector.base
CollectorData
init
Create a data item store information about a message. Used by the data collector.
Parameters:
- id (UUID): The id of the message.
- name (str): The name of the agent.
- role (
Literal["user", "assistant", "system", "function"]
): The role of the message. - message (Optional[str], optional): The message. (default: :obj:
None
) - function_call (Optional[Dict[str, Any]], optional): The function call. (default: :obj:
None
)
from_context
Create a data collector from a context.
Parameters:
- name (str): The name of the agent.
- context (Dict[str, Any]): The context.
Returns:
CollectorData: The data collector.
BaseDataCollector
Base class for data collectors.
init
Create a data collector.
step
Record a message.
Parameters:
- role (
Literal["user", "assistant", "system", "tool"]
): The role of the message. - name (Optional[str], optional): The name of the agent. (default: :obj:
None
) - message (Optional[str], optional): The message to record. (default: :obj:
None
) - function_call (Optional[Dict[str, Any]], optional): The function call to record. (default: :obj:
None
)
Returns:
Self: The data collector.
record
Record agents.
Parameters:
- agent (Union[List[ChatAgent], ChatAgent]): The agent(s) to inject.
start
Start recording.
stop
Stop recording.
recording
Whether the collector is recording.
reset
Reset the collector.
Parameters:
- reset_agents (bool, optional): Whether to reset the agents. Defaults to True.
convert
Convert the collected data.
llm_convert
Convert the collected data.
get_agent_history
Get the message history of an agent.
Parameters:
- name (str): The name of the agent.
Returns:
List[CollectorData]: The message history of the agent