mirror of
https://github.com/hwchase17/langchain.git
synced 2025-04-27 19:46:55 +00:00
langchain: return attachments in _get_response (#30853)
This is a PR to return the message attachments in _get_response, as when files are generated these attachments are not returned thus generated files cannot be retrieved Fixes issue: https://github.com/langchain-ai/langchain/issues/30851
This commit is contained in:
parent
09c1991e96
commit
d30c56a8c1
@ -584,6 +584,9 @@ class OpenAIAssistantRunnable(RunnableSerializable[dict, OutputType]):
|
||||
answer: Any = [
|
||||
msg_content for msg in new_messages for msg_content in msg.content
|
||||
]
|
||||
attachments = [
|
||||
attachment for msg in new_messages for attachment in msg.attachments
|
||||
]
|
||||
if all(
|
||||
(
|
||||
isinstance(content, openai.types.beta.threads.TextContentBlock)
|
||||
@ -601,6 +604,7 @@ class OpenAIAssistantRunnable(RunnableSerializable[dict, OutputType]):
|
||||
"output": answer,
|
||||
"thread_id": run.thread_id,
|
||||
"run_id": run.id,
|
||||
"attachments": attachments,
|
||||
},
|
||||
log="",
|
||||
run_id=run.id,
|
||||
|
Loading…
Reference in New Issue
Block a user