(Openinference Migration: Langchain) Add support for legacy OpenAI function call (PR #2)#281
Open
rads-1996 wants to merge 4 commits into
Open
(Openinference Migration: Langchain) Add support for legacy OpenAI function call (PR #2)#281rads-1996 wants to merge 4 commits into
rads-1996 wants to merge 4 commits into
Conversation
rads-1996
force-pushed
the
langchain-legacy-function-call
branch
from
July 17, 2026 20:28
f7335e3 to
ce0567b
Compare
Pull request dashboard statusStatus last refreshed: 2026-07-25 18:45:09 UTC.
This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected. |
rads-1996
force-pushed
the
langchain-legacy-function-call
branch
2 times, most recently
from
July 21, 2026 20:00
cef69c2 to
5e5a3f8
Compare
rads-1996
marked this pull request as ready for review
July 21, 2026 20:04
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support in the LangChain GenAI instrumentation for legacy (pre-tool_calls) OpenAI additional_kwargs["function_call"] so it surfaces as a ToolCallRequest in both input and output message models, aligning behavior with the modern tool_calls path.
Changes:
- Added
_legacy_function_call_request()helper to parseadditional_kwargs["function_call"](including JSON-string arguments) into aToolCallRequest. - Extended both
_ai_message_parts()(input path) andon_llm_end()(output path) to emit the legacy function call as a tool-call request part. - Added unit tests covering dict/string arguments, absence behavior, and end-to-end callback handler output message behavior; added a towncrier changelog fragment.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| instrumentation/opentelemetry-instrumentation-genai-langchain/tests/test_callback_handler.py | Adds regression/unit tests validating legacy function_call is converted into ToolCallRequest in input/output message modeling. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/utils.py | Implements legacy function_call extraction and wires it into AI message part construction. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/callback_handler.py | Emits legacy function_call as an output tool-call request part during on_llm_end. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/.changelog/281.added | Documents the added legacy function_call capture support. |
rads-1996
force-pushed
the
langchain-legacy-function-call
branch
2 times, most recently
from
July 22, 2026 15:11
310a63f to
c7c6b07
Compare
Surface pre-tools OpenAI `additional_kwargs['function_call']` as a ToolCallRequest in both input and output messages, matching the modern tool_calls path.
rads-1996
force-pushed
the
langchain-legacy-function-call
branch
from
July 23, 2026 21:44
c7c6b07 to
b289022
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of #272
Type of change
Please delete options that are not relevant.
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. List any relevant details for your test
configuration.
Checklist
See CONTRIBUTING.md
for the style guide, changelog guidance, and more.