Skip to content

Commit 3cfd690

Browse files
authored
fix: deep rag output model (#570)
1 parent 6959934 commit 3cfd690

4 files changed

Lines changed: 21 additions & 14 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
22
name = "uipath-langchain"
3-
version = "0.5.47"
3+
version = "0.5.48"
44
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"
77
dependencies = [
8-
"uipath>=2.8.18,<2.9.0",
8+
"uipath>=2.8.21,<2.9.0",
99
"uipath-runtime>=0.8.0, <0.9.0",
1010
"langgraph>=1.0.0, <2.0.0",
1111
"langchain-core>=1.2.11, <2.0.0",

src/uipath_langchain/agent/tools/context_tool.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from langchain_core.documents import Document
77
from langchain_core.tools import StructuredTool
88
from langgraph.types import interrupt
9-
from pydantic import BaseModel, Field
9+
from pydantic import BaseModel, Field, create_model
1010
from uipath.agent.models.agent import (
1111
AgentContextResourceConfig,
1212
AgentContextRetrievalMode,
@@ -17,7 +17,7 @@
1717
BatchTransformOutputColumn,
1818
BatchTransformResponse,
1919
CitationMode,
20-
DeepRagResponse,
20+
DeepRagContent,
2121
)
2222

2323
from uipath_langchain.retrievers import ContextGroundingRetriever
@@ -127,7 +127,11 @@ def handle_deep_rag(
127127
raise ValueError("Citation mode is required for Deep RAG")
128128
citation_mode = CitationMode(resource.settings.citation_mode.value)
129129

130-
output_model = DeepRagResponse
130+
output_model = create_model(
131+
"DeepRagOutputModel",
132+
__base__=DeepRagContent,
133+
deep_rag_id=(str, Field(alias="deepRagId")),
134+
)
131135

132136
if is_static_query(resource):
133137
# Static query - no input parameter needed

tests/agent/tools/test_context_tool.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from uipath.platform.context_grounding import (
1616
BatchTransformResponse,
1717
CitationMode,
18-
DeepRagResponse,
18+
DeepRagContent,
1919
)
2020

2121
from uipath_langchain.agent.tools.context_tool import (
@@ -80,7 +80,10 @@ def test_successful_deep_rag_creation(self, base_resource_config):
8080
assert result.name == "test_deep_rag"
8181
assert result.description == "Test Deep RAG tool"
8282
assert result.args_schema is None
83-
assert result.output_type == DeepRagResponse
83+
assert issubclass(result.output_type, DeepRagContent)
84+
schema = result.output_type.model_json_schema()
85+
assert "deepRagId" in schema["properties"]
86+
assert schema["properties"]["deepRagId"]["type"] == "string"
8487

8588
def test_missing_query_object_raises_error(self, base_resource_config):
8689
"""Test that missing query object raises ValueError."""
@@ -227,7 +230,7 @@ def test_dynamic_query_deep_rag_creation(self, base_resource_config):
227230
assert result.name == "test_deep_rag"
228231
assert result.description == "Test Deep RAG tool"
229232
assert result.args_schema is not None # Dynamic has input schema
230-
assert result.output_type == DeepRagResponse
233+
assert issubclass(result.output_type, DeepRagContent)
231234

232235
def test_dynamic_query_deep_rag_has_query_parameter(self, base_resource_config):
233236
"""Test that dynamic Deep RAG tool has query parameter in schema."""
@@ -329,7 +332,7 @@ def test_create_deep_rag_tool(self, deep_rag_config):
329332
assert isinstance(result, StructuredToolWithOutputType)
330333
assert result.name == "test_deep_rag"
331334
assert result.args_schema is None # Deep RAG has no input schema
332-
assert result.output_type == DeepRagResponse
335+
assert issubclass(result.output_type, DeepRagContent)
333336

334337
def test_case_insensitive_retrieval_mode(self, deep_rag_config):
335338
"""Test that retrieval mode matching is case-insensitive."""

uv.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)