Skip to content

Commit be48e88

Browse files
committed
fix: output parse
1 parent 1dedf47 commit be48e88

7 files changed

Lines changed: 31 additions & 14 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-llamaindex"
3-
version = "0.0.5"
3+
version = "0.0.6"
44
description = "UiPath LlamaIndex SDK"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"

samples/quickstart-agent/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class JokeEvent(Event):
1616
joke: str
1717

1818

19+
class CritiqueEvent(StopEvent):
20+
joke: str
21+
critique: str
22+
23+
1924
class JokeFlow(Workflow):
2025
llm = OpenAI()
2126

@@ -28,12 +33,12 @@ async def generate_joke(self, ev: TopicEvent) -> JokeEvent:
2833
return JokeEvent(joke=str(response))
2934

3035
@step
31-
async def critique_joke(self, ev: JokeEvent) -> StopEvent:
36+
async def critique_joke(self, ev: JokeEvent) -> CritiqueEvent:
3237
joke = ev.joke
3338

3439
prompt = f"Give a thorough analysis and critique of the following joke: {joke}"
3540
response = await self.llm.acomplete(prompt)
36-
return StopEvent(result=str(response))
41+
return CritiqueEvent(joke=joke, critique=str(response))
3742

3843

3944
agent = JokeFlow(timeout=60, verbose=False)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
22
name = "llama-quickstart-agent"
3-
version = "0.0.3"
3+
version = "0.0.5"
44
description = "UiPath LlamaIndex Quickstart Agent"
55
authors = [{ name = "John Doe", email = "john.doe@myemail.com" }]
66
readme = { file = "README.md", content-type = "text/markdown" }
77
requires-python = ">=3.10"
88
dependencies = [
9-
"uipath-llamaindex>=0.0.5",
9+
"uipath-llamaindex>=0.0.6",
1010
"llama-index-llms-openai>=0.2.2"
1111
]

samples/quickstart-agent/uipath.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"entryPoints": [
33
{
44
"filePath": "agent",
5-
"uniqueId": "f646d823-434c-4ef6-b8fb-6a239ee08974",
5+
"uniqueId": "fef68d5e-56cd-4569-b18c-3bce0ef5343f",
66
"type": "agent",
77
"input": {
88
"type": "object",
@@ -18,8 +18,20 @@
1818
},
1919
"output": {
2020
"type": "object",
21-
"properties": {},
22-
"required": []
21+
"properties": {
22+
"joke": {
23+
"title": "Joke",
24+
"type": "string"
25+
},
26+
"critique": {
27+
"title": "Critique",
28+
"type": "string"
29+
}
30+
},
31+
"required": [
32+
"joke",
33+
"critique"
34+
]
2335
}
2436
}
2537
],

samples/quickstart-agent/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uipath_llamaindex/_cli/_runtime/_runtime.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ async def cleanup(self) -> None:
160160
def _serialize_object(self, obj):
161161
"""Recursively serializes an object and all its nested components."""
162162
# Handle Pydantic models
163-
if hasattr(obj, "dict"):
164-
return self._serialize_object(obj.dict())
165-
elif hasattr(obj, "model_dump"):
163+
if hasattr(obj, "model_dump"):
166164
return self._serialize_object(obj.model_dump(by_alias=True))
165+
elif hasattr(obj, "dict"):
166+
return self._serialize_object(obj.dict())
167167
elif hasattr(obj, "to_dict"):
168168
return self._serialize_object(obj.to_dict())
169169
# Handle dictionaries
@@ -180,4 +180,4 @@ def _serialize_object(self, obj):
180180
return obj
181181
# Return primitive types as is
182182
else:
183-
return {"result": obj}
183+
return obj

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)