Set limit of text for response #10768
Replies: 1 comment 2 replies
-
🤖 Hello, Yes, you can set or customize the response text limit in a document-based LangChain app using OpenAI. This can be achieved by adjusting the Here is how you can do it: openai_model = BaseOpenAI(max_tokens=500) In the above code, the maximum number of tokens is set to 500. This will limit the response text to 500 tokens. If you want to remove the limit, you can set openai_model = BaseOpenAI(max_tokens=-1) This will return as many tokens as possible given the prompt and the model's maximal context size. The default value of I hope this helps! If you have any other questions, feel free to ask. Best, SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am building a document based Langchain app using the OpenAI where I want to set the limit or do customization for the response text.
Is there any way which can help me to achieve this ?
Beta Was this translation helpful? Give feedback.
All reactions