[Enhancement]: Enhance Responses API support by keeping track of responses IDs and using them #8203
insilications
started this conversation in
Feature Requests & Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What features would you like to see added?
First, thank you for implementing the Responses API. I'm not sure because it's been a while since I've worked with LibreChat, but it seems that to take full advantage of the Responses API we would need to return the
id
of the lastResponse
object when making a request, for both the/api/agents/chat/:endpoint
and/api/agents/chat/
flow:PS: the default is that the
store
parameter is alwaystrue
.https://platform.openai.com/docs/guides/responses-vs-chat-completions
https://platform.openai.com/docs/guides/conversation-state
formatAgentMessages
receives the incomingpayload
for a certainAgentClient
and formats it as an array of messages for LangChain consumption.LibreChat/api/server/controllers/agents/client.js
Line 706 in 24800bf
The key problem is that the incoming
payload
from the conversation's message history does not contain theResponse
id
because it is obviously not saved in the database. To take full advantage of the Responses API, we would need to save it. LangChain makes things a bit easier: makingformatAgentMessages
return anAIMessage
containing aresponse_metadata.id
property seems to setprevious_response_id
when thatAIMessage
is used in subsequent ChatOpenAI Responses API calls:ChatOpenAICallOptions
:https://github.com/langchain-ai/langchainjs/blob/0166a0411920d98ae610f6351a88dc17002f319d/libs/langchain-openai/src/chat_models.ts#L1202
invocationParams
:https://github.com/langchain-ai/langchainjs/blob/0166a0411920d98ae610f6351a88dc17002f319d/libs/langchain-openai/src/chat_models.ts#L2110
ChatOpenAI
:https://github.com/langchain-ai/langchainjs/blob/0166a0411920d98ae610f6351a88dc17002f319d/libs/langchain-openai/src/chat_models.ts#L1933
More details
Another problem:
We should handle situations where the
Response
id
is older than 30 days and is therefore no longer valid. We can use the timestamp from the database to determine whether to pass all the messages and reasoning items from the history or theResponse
id
.Which components are impacted by your request?
Endpoints
Pictures
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions