- Notifications
You must be signed in to change notification settings - Fork 14
Add support for langchain version 1.0.0 #66
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
base: main
Are you sure you want to change the base?
Add support for langchain version 1.0.0 #66
Conversation
joseph-klein commented Nov 12, 2025
- Also also fix Incorrect tool parameter parsing when LLM call returns it as escaped json dict.
| Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
Signed-off-by: Joe Klein <joseph.klein@oracle.com>
1ce790f to 9919a2e Compare | I will have a look in the next few days. |
…mpatible with previous versions.
| Github build workflow seems to be not working, got this message in email: Error Seems like get-changed-files workflow step is not allowed? |
| so it looks like we are making big changes to accomodate a new version of langchain. Sounds good but we keep making bug fixes for this version, so it may be best to have a fork where we determine what version of langchain we are using or we're going to have to maintain 2 versions of this package mapping to langchain versions |
| @joseph-klein Is it possible to be backward compatible with LangChain < 1.0? |
| Hi @YouNeedCryDear Well I am going back and forth on that. At first I thought no, because langgraph has replaced "create_react_agent" with "create_agent" - the create_react_agent call is gone. But just now I realized - langchain-oracle does not have any dependency on langgraph - its just langchain. So I think maybe it is ok. Here is what I'll do: I will change the dependencies in the PR back so that we can use langchain 0.3 or 1.0.0, then I will test it against our AIDP agent flows and see if the existing flows that use older langchain stuff still works. - Joe On Thursday, November 13, 2025 at 02:09:54 PM CST, Arthur Cheng ***@***.***> wrote: YouNeedCryDear left a comment (oracle/langchain-oracle#66) @joseph-klein Is it possible to be backward compatible with LangChain < 1.0? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: ***@***.***> |
| Hi @streamnsight, Actually the big changes in oci-generative-ai.py are not related to the langgraph upgrade, they are just bugs we found when running AIDP agent flows, and I decided to combine into one PR. For now in AIDP itself we are using a forked version of that python file. If you think they should be 2 different PRs I can split them up. I will do the backward compatibility testing first. I guess if the langgraph version upgrade is backward compatible with the previous oci-langchain, then maybe its ok to combine them. If it is not backward compatible, then I agree, maybe we should make a whole new github repo for "langchain-oracle-1.0.0" or something like that, and I'll add the bug fixes to both. Thanks, Joe On Thursday, November 13, 2025 at 01:18:49 PM CST, Emmanuel Leroy ***@***.***> wrote: streamnsight left a comment (oracle/langchain-oracle#66) so it looks like we are making big changes to accomodate a new version of langchain. Sounds good but we keep making bug fixes for this version, so it may be best to have a fork where we determine what version of langchain we are using or we're going to have to maintain 2 versions of this package mapping to langchain versions — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: ***@***.***> |
| } | ||
| | ||
| # Include token usage if available | ||
| if hasattr(response.data.chat_response, "usage") and response.data.chat_response.usage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this removed? is it taken care of some other way?
| self.oci_chat_message["CHATBOT"]( | ||
| message=messages[len(messages) - i - 2].content | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting changes make it hard to see what really changed. Please run ruff format
| # Response format models | ||
| self.oci_response_json_schema = models.ResponseJsonSchema | ||
| self.oci_json_schema_response_format = models.JsonSchemaResponseFormat | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this being removed?
| # Include token usage if available | ||
| if hasattr(response.data.chat_response, "usage") and response.data.chat_response.usage: | ||
| generation_info["total_tokens"] = response.data.chat_response.usage.total_tokens | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above: why remove? is it taken care of some other way?
| "required": parameters.get("required", []), | ||
| }, | ||
| ) | ||
| elif isinstance(tool, BaseTool): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like it is just being flipped around between if / elif clause. makes diff confusing.
| | ||
| def default_compartment(): | ||
| return "ocid1.tenancy.oc1..aaaaaaaa7ayxuw32vjb64hbxtouarftwtwb2uat5x5mf4hu7cvzaesfrebrq" | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not have anything like this hard coded in the code. This needs to be an environment variable