From 4365d6935922efdeea2f0d56abb0e63c5e6b41dc Mon Sep 17 00:00:00 2001
From: Shahar <shaharhillel4@gmail.com>
Date: Thu, 15 Aug 2024 00:39:48 +0300
Subject: [PATCH] Fix TypeError by replacing this.openai.createChatCompletion
 with the correct function call (#2117)

fixed new api syntax
---
 server/utils/AiProviders/huggingface/index.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/utils/AiProviders/huggingface/index.js b/server/utils/AiProviders/huggingface/index.js
index ec256a292..ddb1f6c42 100644
--- a/server/utils/AiProviders/huggingface/index.js
+++ b/server/utils/AiProviders/huggingface/index.js
@@ -80,7 +80,7 @@ class HuggingFaceLLM {
   }
 
   async getChatCompletion(messages = null, { temperature = 0.7 }) {
-    const result = await this.openai.createChatCompletion({
+    const result = await this.openai.chat.completions.create({
       model: this.model,
       messages,
       temperature,