Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

context_length_exceeded #1

Open
chinesewebman opened this issue Jul 13, 2023 · 0 comments
Open

context_length_exceeded #1

chinesewebman opened this issue Jul 13, 2023 · 0 comments

Comments

@chinesewebman
Copy link

during some search requests, get this:

==================================================================================
2023-07-13 14:31:27 - message='OpenAI API response' path=https://api.openai.com/v1/chat/completions processing_ms=294 request_id=e7c59ac661bf046ea04241c2a16c0258 response_code=400
2023-07-13 14:31:27 - error_code=context_length_exceeded error_message="This model's maximum context length is 4097 tokens. However, your messages resulted in 4238 tokens (4143 in the messages, 95 in the functions). Please reduce the length of the messages or functions." error_param=messages error_type=invalid_request_error message='OpenAI API error received' stream_error=False
Error getting model response: This model's maximum context length is 4097 tokens. However, your messages resulted in 4238 tokens (4143 in the messages, 95 in the functions). Please reduce the length of the messages or functions.
2023-07-13 14:31:27 - 'async for' requires an object with aiter method, got NoneType
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/chainlit/utils.py", line 36, in wrapper
return await user_function(**params_values)
File "/root/Chainlit-OpenAI-Functions/app.py", line 121, in run_conversation
async for stream_resp in model_response:
TypeError: 'async for' requires an object with aiter method, got NoneType

==================================================================================

could you please set the token limit safeguard parameter in the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant