Skip to content

Commit c017a26

Browse files
authored
Merge pull request #354 from UiPath/fix/llamaindex-llm-init-scope
fix: defer llm init in llamaindex scaffold template
2 parents dcdb9a1 + 23513d5 commit c017a26

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

packages/uipath-llamaindex/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.5.14"
3+
version = "0.5.15"
44
description = "Python SDK that enables developers to build and deploy LlamaIndex agents to the UiPath Cloud Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-llamaindex/src/uipath_llamaindex/_cli/_templates/main.py.template

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
from functools import cached_property
2+
13
from llama_index.core.workflow import (
24
Event,
35
StartEvent,
46
StopEvent,
57
Workflow,
68
step,
79
)
8-
from llama_index.llms.openai import OpenAI
10+
11+
from uipath_llamaindex.llms import BedrockModel, GeminiModel, OpenAIModel, UiPathOpenAI
12+
from uipath_llamaindex.llms.bedrock import UiPathChatBedrockConverse
13+
from uipath_llamaindex.llms.vertex import UiPathVertex
914

1015

1116
class TopicEvent(StartEvent):
@@ -22,7 +27,12 @@ class CritiqueEvent(StopEvent):
2227

2328

2429
class JokeFlow(Workflow):
25-
llm = OpenAI()
30+
@cached_property
31+
def llm(self):
32+
# Choose your LLM provider by uncommenting one of the following:
33+
return UiPathChatBedrockConverse(model=BedrockModel.anthropic_claude_haiku_4_5)
34+
# return UiPathOpenAI(model=OpenAIModel.GPT_4_1_MINI_2025_04_14.value)
35+
# return UiPathVertex(model=GeminiModel.gemini_2_5_flash)
2636

2737
@step
2838
async def generate_joke(self, ev: TopicEvent) -> JokeEvent:

packages/uipath-llamaindex/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)