Skip to content

Commit

Permalink
Update completions.js
Browse files Browse the repository at this point in the history
  • Loading branch information
serefyarar committed Nov 29, 2024
1 parent 2597537 commit 1e2bde5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/src/language/completions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});

const encoding = tiktoken.encoding_for_model(process.env.MODEL_CHAT);
const encoding = tiktoken.encoding_for_model('gpt-4o');

const formatChatHistory = (messages) => {
if (!Array.isArray(messages)) return '';
Expand Down Expand Up @@ -67,6 +67,7 @@ export const handleCompletions = async ({ messages, indexIds, maxDocs=500, strea
const retrievedDocs = filteredDocs.join('\n');

console.log('totalTokens', totalTokens)
console.log('totalTokens)

if (retrievedDocs) {
messages.push({
Expand Down

0 comments on commit 1e2bde5

Please sign in to comment.