Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[openai]: responses API #7831

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

feat[openai]: responses API #7831

wants to merge 4 commits into from

Conversation

dqbd
Copy link
Collaborator

@dqbd dqbd commented Mar 12, 2025

Fixes # (issue)

Copy link

vercel bot commented Mar 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2025 3:51pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Mar 12, 2025 3:51pm

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 12, 2025
@dqbd dqbd marked this pull request as draft March 12, 2025 00:46
@dosubot dosubot bot added the auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features label Mar 12, 2025
Comment on lines +237 to +238
call_id: toolCall.id!,
id: toolCall.id!,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are different i believe. 'id' is the object id, 'call_id' is what you'll use to refer to this tool call when returning the output

Screenshot 2025-03-11 at 5 58 04 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'call_id' maps to what we store as toolCall.id

Copy link
Contributor

@baskaryan baskaryan Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now was thinking of throwing the new 'id' for all tool calls in AIMessage.additionalKwargs['openai_tool_call_ids'] or something like that. and it'd be a map from call_id -> id

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smth like

            if tool_calls := lc_msg.tool_calls:
                if not lc_msg.additional_kwargs.get("__openai_function_call_ids__"):
                    raise ValueError(...)
                function_call_ids = lc_msg.additional_kwargs["__openai_function_call_ids__"]
                for tool_call in tool_calls:
                    function_call = {
                        "type": "function_call",
                        "name": tool_call["name"],
                        "arguments": tool_call["arguments"],
                        "call_id": tool_call["id"],
                        "id": function_call_ids[tool_call["id"]],
                    }
                    updated_payload["input"].append(function_call)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants