Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Fix OpenAI Assistant (#1393)

Dev Khant00c1fa1ec70d
diff --git a/embedchain/store/assistants.py b/embedchain/store/assistants.py
index 9098cc7c5..b9ca151ab 100644
--- a/embedchain/store/assistants.py
+++ b/embedchain/store/assistants.py
@@ -8,7 +8,8 @@ from pathlib import Path
from typing import cast
from openai import OpenAI
-from openai.types.beta.threads import MessageContentText, ThreadMessage
+from openai.types.beta.threads import Message
+from openai.types.beta.threads.text_content_block import TextContentBlock
from embedchain import Client, Pipeline
from embedchain.config import AddConfig
@@ -130,8 +131,8 @@ class OpenAIAssistant:
@staticmethod
def _format_message(thread_message):
- thread_message = cast(ThreadMessage, thread_message)
- content = [c.text.value for c in thread_message.content if isinstance(c, MessageContentText)]
+ thread_message = cast(Message, thread_message)
+ content = [c.text.value for c in thread_message.content if isinstance(c, TextContentBlock)]
return " ".join(content)
@staticmethod