Skip to content

Commit

Permalink
Use Max Token while TPM check
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihturker committed May 20, 2023
1 parent 472b50f commit ccf05c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/agi/main.agi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export class MainAGI<T extends ActionType> {
max_tokens
);

currentToken += this.openAIProvider.countTokens(nextPrompt);
currentToken += this.openAIProvider.getDefaultMaxToken();

this.loggerUtil.log('Response is captured. Processing..');

Expand Down
4 changes: 4 additions & 0 deletions lib/provider/open-ai.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export class OpenAIAzureProvider {
return this.MAX_TOKEN_COUNT - this.countTokens(prompt) - 10;
};

getDefaultMaxToken = () => {
return this.MAX_TOKEN_COUNT;
};

/**
* Sends a completion request to OpenAI API.
*
Expand Down

0 comments on commit ccf05c0

Please sign in to comment.