You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I ask CodeAgent to summarize a long text, instead of leaving this job to the LLM it tries to whip up mediocre summarization algorithms. I worked around this issue by creating a SummarizationTool that passes the job to the LLM, but that looks convoluted. Are there more elegant ways?
def LLM_QandA(model, question):
messages = [
{
'role': 'user',
'content':
[
{
'type': 'text',
'text': question
}
]
}
]
return model(messages).content
class Summarization_Tool(Tool):
name = "summarization_tool"
description = ("This is a tool that summarizes the input (a long multi-line string)")
inputs = {
"long_text": {
"type": "string",
"description": "The text to be summarized."
}
}
output_type = "string"
def __init__(self, model):
super().__init__()
self.model = model
def forward(self, long_text):
return LLM_QandA(self.model, r'summarize the following text:\n\n' + long_text)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When I ask CodeAgent to summarize a long text, instead of leaving this job to the LLM it tries to whip up mediocre summarization algorithms. I worked around this issue by creating a SummarizationTool that passes the job to the LLM, but that looks convoluted. Are there more elegant ways?
Beta Was this translation helpful? Give feedback.
All reactions