crewAI
crewAI copied to clipboard
How to set max tokens limitations for agents
Dear team, fantastic job so far! 🌷
We've successfully deployed multiple agents to collaborate. However, I'm encountering a challenge in limiting their response lengths. Despite instructions for conciseness in tasks, the outputs remain lengthy. Additionally, I incorporated a summarizer agent into the process for brief final responses, but issues persist.
Specifically, some agents, like analyzers, need only provide a singular, precise response. For instance, a rudeness detector agent should simply classify input as rude or not, without further elaboration.
Reducing text output seems beneficial, but our agents tend to be overly verbose. I've considered setting a maximum token limit to tackle this but have yet to find a way to implement it.
I have set the max_token here like this:
llm_lmstudio = ChatOpenAI(
openai_api_base="http://localhost:1234/v1" ,
openai_api_key="some-key",
model_name="dolphin",
model="dolphin",
max_tokens=100
)
but not worked with my local llm.
Any assistance or suggestions on this matter would be greatly appreciated.