Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions libs/oci/langchain_oci/chat_models/oci_generative_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,8 +931,8 @@ def convert_to_oci_tool(
"required": parameters.get("required", []),
},
)
elif isinstance(tool, BaseTool): # type: ignore[unreachable]
return self.oci_function_definition( # type: ignore[unreachable]
elif isinstance(tool, BaseTool):
return self.oci_function_definition(
name=tool.name,
description=OCIUtils.remove_signature_from_tool_description(
tool.name, tool.description
Expand Down Expand Up @@ -1206,13 +1206,13 @@ 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,
**kwargs: Any,
) -> Runnable[LanguageModelInput, BaseMessage]:
) -> Runnable[LanguageModelInput, AIMessage]:
"""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