Skip to content

Commit bbc58ff

Browse files
committed
increment max_tokens for demo && update readme
1 parent 9ddddaa commit bbc58ff

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ source .venv/bin/activate
109109
make install
110110
```
111111

112-
**Note**: _This command will automatically generate a `.env` file from `.env.example`, uninstall the old version of poetry on your machine, then install latest version `1.6.1`, and install the required main dependencies._
112+
> **Note**<br>
113+
This command will automatically generate a `.env` file from `.env.example`, uninstall the old version of poetry on your machine, then install latest version `1.6.1`, and install the required main dependencies._
113114

114115
### 4. Setup a MongoDB Account and Configure Your Database
115116

@@ -558,6 +559,10 @@ As an algorithm expert, your mission is to craft a comprehensive algorithm tutor
558559

559560
OpenAI supports a wide range of programming languages for algorithm generation. Users can specify their preferred programming language when requesting algorithmic posts. Commonly supported languages include Python, Java, JavaScript, C++, and more.
560561

562+
### Q5: How can I set the maximum tokens for the OpenAI API when making requests?
563+
564+
Controlling the maximum algorithmic email length can be achieved by setting the maximum number of tokens allowed in the generated text, namely [`max_tokens`](https://github.com/coder-inbox/code-inbox-server/blob/main/src/utils/openai_api.py#L41). Tokens are units of text that can be as short as one character or as long as one word. To control email length, set the parameter `max_tokens` to a value that ensures your email content remains within the token limit. For example, if the token limit is 1024 tokens, you might set `max_tokens` to 1024.
565+
561566
---
562567

563568
## Upcoming Features

src/utils/openai_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class OpenAIAPI:
3838
api_token: str
3939
model: str = "gpt-3.5-turbo"
4040
temperature: float = 0
41-
max_tokens: int = 512
41+
max_tokens: int = 1024
4242
top_p: float = 1
4343
frequency_penalty: float = 0
4444
presence_penalty: float = 0.6

0 commit comments

Comments
 (0)