MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

Limit error when running program

Open mandarin77 opened this issue 2 years ago • 4 comments
trafficstars

When running the program, I get the following error. Is there a way to resolve the limitations?

openai.error.InvalidRequestError: This model's maximum context length is 4097 tokens. However, you requested 4264 tokens (1264 in the messages, 3000 in the completion). Please reduce the length of the messages or completion.

mandarin77 avatar Aug 08 '23 17:08 mandarin77

Modify the config in config/key.yaml.

  1. OPENAI_API_MODEL change to gpt-3.5-turbo-16k or gpt-4.
  2. MAX_TOKENS change to 5000.

voidking avatar Aug 09 '23 03:08 voidking

Thank you for your response. I tried setting to turbo as you stated, and 5000 MAX_TOKENS, but I now get this error. Please advise and thanks for your help.

result = await fn(*args, **kwargs)

File "C:\MetaGPT\metagpt\actions\action.py", line 62, in _aask_v1 instruct_content = output_class(**parsed_data) File "pydantic\main.py", line 341, in pydantic.main.BaseModel.init pydantic.error_wrappers.ValidationError: 7 validation errors for prd Requirement Pool -> 0 value is not a valid tuple (type=type_error.tuple) Requirement Pool -> 1 value is not a valid tuple (type=type_error.tuple) Requirement Pool -> 2 value is not a valid tuple (type=type_error.tuple) Requirement Pool -> 3 value is not a valid tuple (type=type_error.tuple) Requirement Pool -> 4 value is not a valid tuple (type=type_error.tuple) Requirement Pool -> 5 value is not a valid tuple (type=type_error.tuple) Requirement Pool -> 6 value is not a valid tuple (type=type_error.tuple)

mandarin77 avatar Aug 09 '23 11:08 mandarin77

This problem actually comes from the poor Instruction Following of gpt-3.5-turbo. gpt-4 basically does not have this problem

geekan avatar Sep 09 '23 03:09 geekan