Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jhakulin committed May 5, 2024
1 parent 9d4161e commit 3cd4a39
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,25 @@ async def create_conversation_thread_message(
thread_id = self._thread_config.get_thread_id_by_name(thread_name)
attachments = await self._update_message_attachments(thread_id, attachments) if attachments is not None else []

# Create the message with the attachments
await self._ai_client.beta.threads.messages.create(
thread_id,
role=role,
metadata=metadata,
attachments=attachments,
content=message,
timeout=timeout
)
if attachments:
# Create the message with the attachments
await self._ai_client.beta.threads.messages.create(
thread_id,
role=role,
metadata=metadata,
attachments=attachments,
content=message,
timeout=timeout
)
else:
# Create the message without attachments
await self._ai_client.beta.threads.messages.create(
thread_id,
role=role,
metadata=metadata,
content=message,
timeout=timeout
)

logger.info(f"Created message: {message} in thread: {thread_id}, attachments: {attachments}")
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,25 @@ def create_conversation_thread_message(
thread_id = self._thread_config.get_thread_id_by_name(thread_name)
attachments = self._update_message_attachments(thread_id, attachments) if attachments is not None else []

# Create the message with the attachments
self._ai_client.beta.threads.messages.create(
thread_id,
role=role,
metadata=metadata,
attachments=attachments,
content=message,
timeout=timeout
)
if attachments:
# Create the message with the attachments
self._ai_client.beta.threads.messages.create(
thread_id,
role=role,
metadata=metadata,
attachments=attachments,
content=message,
timeout=timeout
)
else:
# Create the message without attachments
self._ai_client.beta.threads.messages.create(
thread_id,
role=role,
metadata=metadata,
content=message,
timeout=timeout
)

logger.info(f"Created message: {message} in thread: {thread_id}, attachments: {attachments}")
except Exception as e:
Expand Down

0 comments on commit 3cd4a39

Please sign in to comment.