-
Notifications
You must be signed in to change notification settings - Fork 16
Add LangChain 1.x support #75
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?
Conversation
## Breaking Changes - Python 3.10+ required (dropped Python 3.9 support) - Requires langchain-core>=1.0.0,<2.0.0 - Requires langchain>=1.0.0,<2.0.0 - Requires langchain-openai>=1.0.0,<2.0.0 ## Test Summary | Test Suite | Passed | Total | |------------|--------|-------| | Unit Tests | 35 | 35 | | Integration Tests | 66 | 67 | | **Total** | **101** | **102** | ## Compatibility Testing ### LangChain 1.1.0 (Target Version) ``` langchain==1.1.0 langchain-core==1.1.0 langchain-openai==1.1.0 ``` - Unit tests: 35/35 passed (100%) - Integration tests: 66/67 passed (98.5%) ### LangChain 0.3.x (Backwards Compatibility Verified) ``` langchain==0.3.27 langchain-core==0.3.80 langchain-openai==0.3.35 ``` - Unit tests: 35/35 passed (100%) - Verified backwards compatibility works ## New Integration Test Files 1. **test_langchain_compatibility.py** (17 tests) - Basic invoke, streaming, async - Tool calling (single, multiple) - Structured output (function calling, JSON mode) - Response format tests - LangChain 1.x specific API tests 2. **test_chat_features.py** (16 tests) - LCEL chain tests (simple, with history, batch) - Async chain invocation - Streaming through chains - Tool calling in chain context - Structured output extraction - Model configuration tests - Conversation pattern tests 3. **test_multi_model.py** (33 tests) - Meta Llama models (4-scout, 4-maverick, 3.3-70b, 3.1-70b) - xAI Grok models (grok-3-70b, grok-3-mini-8b, grok-4-fast) - OpenAI models (gpt-oss-20b, gpt-oss-120b) - Cross-model consistency tests - Streaming tests across vendors ## Models Tested (Real OCI Inference - Chicago Region) ### Meta Llama | Model | Basic | Streaming | Tool Calling | Structured Output | |-------|-------|-----------|--------------|-------------------| | meta.llama-4-scout-17b-16e-instruct | ✅ | ✅ | ✅ | ✅ | | meta.llama-4-maverick-17b-128e-instruct-fp8 | ✅ | ✅ | ✅ | ✅ | | meta.llama-3.3-70b-instruct | ✅ | ✅ | ✅ | ✅ | | meta.llama-3.1-70b-instruct | ✅ | ✅ | ✅ | ✅ | ### xAI Grok | Model | Basic | Streaming | Tool Calling | Structured Output | |-------|-------|-----------|--------------|-------------------| | xai.grok-3-70b | ✅ | ✅ | ✅ | ✅ | | xai.grok-3-mini-8b | ✅ | ✅ | ✅ | ✅ | | xai.grok-4-fast-non-reasoning | ✅ | ✅ | ✅ | ✅ | ### OpenAI | Model | Basic | Streaming | Tool Calling | Structured Output | |-------|-------|-----------|--------------|-------------------| | openai.gpt-oss-20b | ✅ | ✅ | ✅ | ✅ | | openai.gpt-oss-120b | ✅ | ✅ | ✅ | ✅ | ## Code Changes - pyproject.toml: Updated dependencies to LangChain 1.x - test_tool_calling.py: Fixed import (langchain.tools -> langchain_core.tools) - test_oci_data_science.py: Updated stream chunk count assertion for LangChain 1.x
Additional Test EvidenceUnit Test Output (LangChain 1.1.0)Integration Test Output (Real OCI Inference)test_langchain_compatibility.pytest_chat_features.pytest_multi_model.pyBackwards Compatibility Test (LangChain 0.3.x)Test Environment
|
Review Request (Active Contributors)@YouNeedCryDear @paxiaatucsdedu @furqan-shaikh-dev - Would appreciate your review on this LangChain 1.x upgrade PR. |
- Update pytest to ^8.0.0 (required by pytest-httpx) - Update pytest-httpx to >=0.30.0 (compatible with httpx 0.28.1) - Update langgraph to ^1.0.0 (required by langchain 1.x) - Regenerate poetry.lock
- Remove main() functions with print statements - Fix import sorting issues - Remove unused imports - Fix line length violations - Format code with ruff
langchain-core 1.1.0 introduced ModelProfileRegistry which is required by langchain-tests 1.0.0. Update minimum version constraint to ensure CI resolves to a compatible version.
- Update bind_tools signature to match BaseChatModel (AIMessage return, tool_choice parameter) - Add isinstance checks for content type in integration tests - Remove unused type: ignore comments - Add proper type annotations for message lists - Import AIMessage in oci_data_science.py
|
#66 |
|
Thanks for the pointer @YouNeedCryDear! I reviewed PR #66 by @joseph-klein. Comparison: PR #75 vs PR #66
Key DifferencesPR #75 (this PR) - Laser-Focused Upgrade:
PR #66 - Combined Upgrade + Refactoring:
My RecommendationI believe smaller, focused PRs are easier to review and safer to merge. This PR (#75) intentionally does the minimum required for LangChain 1.x compatibility without bundling unrelated changes. If there are legitimate bug fixes in PR #66 (like the escaped JSON parsing), those could be submitted as a separate PR to keep concerns separated. @joseph-klein - Happy to collaborate! If you have specific fixes that should be included, we could coordinate. My goal was to keep this upgrade as low-risk as possible with extensive test coverage to validate nothing broke. |
Summary
This PR upgrades langchain-oci to support LangChain 1.x (specifically tested with 1.1.0) and adds comprehensive integration tests to ensure compatibility.
Key Changes:
Breaking Changes
Test Evidence
Test Summary
Compatibility Testing
LangChain 1.1.0 (Target Version)
LangChain 0.3.x (Backwards Compatibility)
New Integration Test Files
Models Tested (Real OCI Inference - Chicago Region)
Meta Llama
xAI Grok
OpenAI (OCI-hosted)
Code Changes
pyproject.toml
test_tool_calling.py
langchain.tools→langchain_core.toolstest_oci_data_science.py
Test Plan