crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

How to set max tokens limitations for agents

Open Archer-Thane opened this issue 1 year ago • 0 comments

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.

Archer-Thane avatar Jan 28 '24 08:01 Archer-Thane