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

🐛 Fix bug that arises when using negative max_tokens #937

Merged
merged 1 commit into from
Jul 3, 2023

Conversation

asim-shrestha
Copy link
Contributor

About

We can request a negative max token value when the completion tokens are that significant

This results in a strange response from OpenAI:

-2473 is less than the minimum of 1 - 'max_tokens'

This PR will ensure we have a minimum value of 1 max_tokens. This will result in the following response:

This model's maximum context length is 4097 tokens. However, your messages resulted in 6478 tokens. Please reduce the length of the messages.

Also added some tests for this method and moved it into the token_service

@vercel
Copy link

vercel bot commented Jul 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
agent-gpt ✅ Ready (Inspect) Visit Preview Jul 3, 2023 0:46am
docs ✅ Ready (Inspect) Visit Preview Jul 3, 2023 0:46am

from reworkd_platform.web.api.agent.model_settings import WrappedChatOpenAI


class TokenService:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@awtkns
Copy link
Member

awtkns commented Jul 3, 2023

Love the tests ❤️

@ergomake
Copy link

ergomake bot commented Jul 3, 2023

Hi 👋

Here's a preview environment 🚀

https://next-reworkd-agentgpt-937.env.ergomake.link

Environment Summary 📑

Container Source URL
next Dockerfile https://next-reworkd-agentgpt-937.env.ergomake.link
docs Dockerfile https://docs-reworkd-agentgpt-937.env.ergomake.link
platform Dockerfile https://platform-reworkd-agentgpt-937.env.ergomake.link
db Dockerfile [not exposed - internal service]
weaviate semitechnologies/weaviate:1.19.6 https://weaviate-reworkd-agentgpt-937.env.ergomake.link

Questions? Comments? Suggestions? Join Discord.

Click here to disable Ergomake.

@asim-shrestha asim-shrestha merged commit ee22203 into main Jul 3, 2023
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

Successfully merging this pull request may close these issues.

2 participants