Generate a response to the given query using the language model.
Parameters: |
-
query
(str )
–
The input query to respond to.
|
Returns: |
-
AgentResponse
–
An object containing the response text, confidence score, and metadata.
|
Notes
Currently, the confidence score is set to a default value of 1.0 and can be adjusted based on future requirements.
Source code in llamarch/common/base_agent.py
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 | async def generate_response(self, query: str) -> AgentResponse:
"""
Generate a response to the given query using the language model.
Parameters
----------
query : str
The input query to respond to.
Returns
-------
AgentResponse
An object containing the response text, confidence score, and metadata.
Notes
-----
Currently, the confidence score is set to a default value of 1.0 and can be adjusted based on future requirements.
"""
response_text = self.llm.generate(query)
confidence = 1.0 # Placeholder; this could be dynamically calculated if desired
metadata = {
"model_name": self.llm.model_name
}
return AgentResponse(agent_id=self.agent_id, response=response_text, confidence=confidence, metadata=metadata)
|