Skip to content

Commit 5bf6e8e

Browse files
committed
Support both LangChain 0.3.x and 1.x via Python version markers
This commit enables LangChain 1.x support WITHOUT breaking changes by using Python-version-conditional dependencies: - Python 3.9 users: Continue using LangChain 0.3.x (no breaking change) - Python 3.10+ users: Automatically get LangChain 1.x (new capability) Changes: - Add conditional dependency markers in pyproject.toml - Regenerate poetry.lock with proper version markers - Handle type compatibility between LangChain versions This approach ensures CI testing works correctly: - Python 3.9 tests use LangChain 0.3.x - Python 3.10+ tests use LangChain 1.x - Minimum version testing respects Python version constraints
1 parent c693948 commit 5bf6e8e

File tree

4 files changed

+146
-60
lines changed

4 files changed

+146
-60
lines changed

libs/oci/langchain_oci/chat_models/oci_generative_ai.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ def with_structured_output(
13581358
key_name=tool_name, first_tool_only=True
13591359
)
13601360
elif method == "json_mode":
1361-
llm = self.bind(response_format={"type": "JSON_OBJECT"})
1361+
llm = self.bind(response_format={"type": "JSON_OBJECT"}) # type: ignore[assignment]
13621362
output_parser = (
13631363
PydanticOutputParser(pydantic_object=schema)
13641364
if is_pydantic_schema
@@ -1382,7 +1382,7 @@ def with_structured_output(
13821382
json_schema=response_json_schema
13831383
)
13841384

1385-
llm = self.bind(response_format=response_format_obj)
1385+
llm = self.bind(response_format=response_format_obj) # type: ignore[assignment]
13861386
if is_pydantic_schema:
13871387
output_parser = PydanticOutputParser(pydantic_object=schema)
13881388
else:

0 commit comments

Comments
 (0)