Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
13b3602
Add LangChain 1.x support and comprehensive integration tests
fede-kamel Nov 26, 2025
a0db8c5
Fix CI: Update poetry.lock and fix dependency conflicts
fede-kamel Nov 26, 2025
f515cd3
Fix linting issues in integration tests
fede-kamel Nov 26, 2025
6674ef6
Require langchain-core>=1.1.0 for ModelProfileRegistry
fede-kamel Nov 26, 2025
0864c9e
Fix mypy type errors for LangChain 1.x compatibility
fede-kamel Nov 26, 2025
defa0b7
Restore type: ignore for mock HTTPError responses
fede-kamel Nov 26, 2025
42c2358
Add comprehensive integration tests for OpenAI models
fede-kamel Dec 1, 2025
63c0426
Fix linting issues in test files
fede-kamel Dec 1, 2025
68231af
Update CI matrix to test Python 3.9, 3.12, 3.13
fede-kamel Dec 2, 2025
7a15cb2
Restore backward compatibility with LangChain 0.3.x
fede-kamel Dec 2, 2025
d74b49a
Fix test_message_text_property to work with both LangChain 0.3.x and 1.x
fede-kamel Dec 2, 2025
20a1327
Skip JSON mode tests for OpenAI models due to 500 errors
fede-kamel Dec 2, 2025
4185b91
Fix mypy type errors for bind() return type narrowing
fede-kamel Dec 2, 2025
eac4d00
Update poetry.lock for Python 3.9 support
fede-kamel Dec 2, 2025
6f3e9b8
Fix Python 3.9 compatibility
fede-kamel Dec 2, 2025
c693948
Remove unused type ignore comments for mypy
fede-kamel Dec 2, 2025
5bf6e8e
Support both LangChain 0.3.x and 1.x via Python version markers
fede-kamel Dec 2, 2025
5eb591e
Fix Python 3.9 compatibility issues in tests
fede-kamel Dec 2, 2025
3499780
Fix mypy unreachable error code in test
fede-kamel Dec 2, 2025
d7be806
Fix get_min_versions.py to respect Python version markers
fede-kamel Dec 2, 2025
580750d
Add clarifying comment for type annotation in bind_tools
fede-kamel Dec 3, 2025
304d33a
Move test_openai_model.py to integration tests directory
fede-kamel Dec 3, 2025
915c40a
Convert test_openai_model.py to proper pytest format
fede-kamel Dec 5, 2025
589614e
Address review feedback from @paxiaatucsdedu
fede-kamel Dec 8, 2025
5244e47
Remove script-style test file - keep only proper pytest integration t…
fede-kamel Dec 8, 2025
c2be785
Remove unused type ignore comments in test_openai_models.py
fede-kamel Dec 8, 2025
d728f28
Add unused-ignore to type ignores for cross-version LangChain compati…
fede-kamel Dec 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions libs/oci/langchain_oci/chat_models/oci_data_science.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
agenerate_from_stream,
generate_from_stream,
)
from langchain_core.messages import AIMessageChunk, BaseMessage, BaseMessageChunk
from langchain_core.messages import (
AIMessage,
AIMessageChunk,
BaseMessage,
BaseMessageChunk,
)
from langchain_core.output_parsers import (
JsonOutputParser,
PydanticOutputParser,
Expand Down Expand Up @@ -765,10 +770,14 @@ def _process_response(self, response_json: dict) -> ChatResult:

def bind_tools(
self,
tools: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool]],
tools: Sequence[Union[Dict[str, Any], type, Callable, BaseTool]],
*,
tool_choice: Optional[str] = None,
**kwargs: Any,
) -> Runnable[LanguageModelInput, BaseMessage]:
) -> Runnable[LanguageModelInput, AIMessage]:
formatted_tools = [convert_to_openai_tool(tool) for tool in tools]
if tool_choice is not None:
kwargs["tool_choice"] = tool_choice
return super().bind(tools=formatted_tools, **kwargs)


Expand Down
4 changes: 2 additions & 2 deletions libs/oci/langchain_oci/chat_models/oci_generative_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,14 +1236,14 @@ def _prepare_request(

def bind_tools(
self,
tools: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool]],
tools: Sequence[Union[Dict[str, Any], type, Callable, BaseTool]],
*,
tool_choice: Optional[
Union[dict, str, Literal["auto", "none", "required", "any"], bool]
] = None,
parallel_tool_calls: Optional[bool] = None,
**kwargs: Any,
) -> Runnable[LanguageModelInput, BaseMessage]:
) -> Runnable[LanguageModelInput, AIMessage]:
Copy link
Member

Choose a reason for hiding this comment

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

May I ask why use AIMessage instead of BaseMessage? It seems to introduce many type errors? Is it possible to resolve these type errors instead of ignore them? @fede-kamel

"""Bind tool-like objects to this chat model.

Assumes model is compatible with Meta's tool-calling API.
Expand Down
932 changes: 243 additions & 689 deletions libs/oci/poetry.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions libs/oci/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ version = "0.2.0"
description = "An integration package connecting OCI and LangChain"
readme = "README.md"
license = "UPL-1.0"
requires-python = ">=3.9,<4.0"
requires-python = ">=3.10,<4.0"
dependencies = [
"langchain-core>=0.3.78,<1.0.0",
"langchain>=0.3.20,<1.0.0",
"langchain-core>=1.1.0,<2.0.0",
"langchain>=1.0.0,<2.0.0",
"oci>=2.161.0",
"pydantic>=2,<3",
"aiohttp>=3.12.14",
"openai>=2.6.1",
"oci-openai>=1.0.0",
"langchain-openai>=0.3.35",
"langchain-openai>=1.0.0,<2.0.0",
]

[project.urls]
Expand All @@ -27,18 +27,18 @@ package-mode = true
optional = true

[tool.poetry.group.test.dependencies]
pytest = "^7.4.3"
pytest = "^8.0.0"
pytest-cov = "^4.1.0"
syrupy = "^4.0.2"
pytest-asyncio = "^0.23.2"
pytest-watcher = "^0.3.4"
langchain-tests = "^0.3.12"
langchain-tests = "^1.0.0"
pytest-socket = "^0.7.0"
pytest-mock = "^3.15.0"
pytest-httpx = "^0.28.0"
pytest-httpx = ">=0.30.0"
responses = "^0.25.8"
langgraph = "^0.2.0"
langchain-openai = "^0.3.35"
langgraph = "^1.0.0"
langchain-openai = "^1.0.0"


[tool.poetry.group.codespell]
Expand All @@ -51,7 +51,7 @@ codespell = "^2.2.6"
optional = true

[tool.poetry.group.test_integration.dependencies]
langgraph = "^0.2.0"
langgraph = "^1.0.0"

[tool.poetry.group.lint]
optional = true
Expand Down
Loading