|
1 | 1 | # LLMs and Embeddings |
2 | 2 |
|
3 | 3 | UiPath provides pre-configured LLM and embedding classes that handle authentication, routing, and configuration automatically, allowing you to focus on building your agents. |
4 | | -You do not need to add tokens from OpenAI, usage of these models will consume `Agent Units` on your account. |
| 4 | +You do not need to add API keys from OpenAI, AWS, or Google, usage of these models will consume `Agent Units` on your account. |
5 | 5 |
|
6 | 6 | ## UiPathOpenAI |
7 | 7 |
|
@@ -97,10 +97,100 @@ embeddings = embed_model.get_text_embedding_batch(texts) |
97 | 97 | print(f"Number of embeddings: {len(embeddings)}") |
98 | 98 | ``` |
99 | 99 |
|
| 100 | +## UiPathChatBedrock and UiPathChatBedrockConverse |
| 101 | + |
| 102 | +`UiPathChatBedrock` and `UiPathChatBedrockConverse` provide access to AWS Bedrock models through UiPath using the Invoke API and Converse API respectively. |
| 103 | + |
| 104 | +### Installation |
| 105 | + |
| 106 | +These classes require additional dependencies. Install them with: |
| 107 | + |
| 108 | +```bash |
| 109 | +pip install uipath-llamaindex[bedrock] |
| 110 | +# or using uv: |
| 111 | +uv add 'uipath-llamaindex[bedrock]' |
| 112 | +``` |
| 113 | + |
| 114 | +### Example Usage |
| 115 | + |
| 116 | +```python |
| 117 | +from uipath_llamaindex.llms.bedrock import UiPathChatBedrockConverse |
| 118 | +from uipath_llamaindex.llms import BedrockModel |
| 119 | +from llama_index.core.llms import ChatMessage |
| 120 | + |
| 121 | +# Create an LLM instance with default settings |
| 122 | +llm = UiPathChatBedrockConverse() |
| 123 | + |
| 124 | +# Or use a specific model |
| 125 | +llm = UiPathChatBedrockConverse(model=BedrockModel.anthropic_claude_sonnet_4_5) |
| 126 | + |
| 127 | +# Create chat messages |
| 128 | +messages = [ |
| 129 | + ChatMessage(role="user", content="Hello"), |
| 130 | +] |
| 131 | + |
| 132 | +# Generate a response |
| 133 | +response = llm.chat(messages) |
| 134 | +print(response) |
| 135 | +``` |
| 136 | + |
| 137 | +Similarly, `UiPathChatBedrock` can be used with the Invoke API: |
| 138 | + |
| 139 | +```python |
| 140 | +from uipath_llamaindex.llms.bedrock import UiPathChatBedrock |
| 141 | +from uipath_llamaindex.llms import BedrockModel |
| 142 | + |
| 143 | +llm = UiPathChatBedrock(model=BedrockModel.anthropic_claude_sonnet_4) |
| 144 | +``` |
| 145 | + |
| 146 | +Currently, the following models can be used (this list can be updated in the future): |
| 147 | + |
| 148 | +- `anthropic.claude-3-7-sonnet-20250219-v1:0`, `anthropic.claude-sonnet-4-20250514-v1:0`, `anthropic.claude-sonnet-4-5-20250929-v1:0`, `anthropic.claude-haiku-4-5-20251001-v1:0` |
| 149 | + |
| 150 | +## UiPathVertex |
| 151 | + |
| 152 | +`UiPathVertex` provides access to Google Vertex AI (Gemini) models through UiPath. |
| 153 | + |
| 154 | +### Installation |
| 155 | + |
| 156 | +This class requires additional dependencies. Install them with: |
| 157 | + |
| 158 | +```bash |
| 159 | +pip install uipath-llamaindex[vertex] |
| 160 | +# or using uv: |
| 161 | +uv add 'uipath-llamaindex[vertex]' |
| 162 | +``` |
| 163 | + |
| 164 | +### Example Usage |
| 165 | + |
| 166 | +```python |
| 167 | +from uipath_llamaindex.llms.vertex import UiPathVertex |
| 168 | +from uipath_llamaindex.llms import GeminiModel |
| 169 | +from llama_index.core.llms import ChatMessage |
| 170 | + |
| 171 | +# Create an LLM instance with default settings |
| 172 | +llm = UiPathVertex() |
| 173 | + |
| 174 | +# Or use a specific model |
| 175 | +llm = UiPathVertex(model=GeminiModel.gemini_2_5_pro) |
| 176 | + |
| 177 | +# Create chat messages |
| 178 | +messages = [ |
| 179 | + ChatMessage(role="user", content="Hello"), |
| 180 | +] |
| 181 | + |
| 182 | +# Generate a response |
| 183 | +response = llm.chat(messages) |
| 184 | +print(response) |
| 185 | +``` |
| 186 | + |
| 187 | +Currently, the following models can be used (this list can be updated in the future): |
| 188 | + |
| 189 | +- `gemini-2.0-flash-001`, `gemini-2.5-flash`, `gemini-2.5-pro` |
100 | 190 |
|
101 | 191 | ## Integration with LlamaIndex |
102 | 192 |
|
103 | | -Both classes integrate seamlessly with LlamaIndex components: |
| 193 | +These classes integrate seamlessly with LlamaIndex components: |
104 | 194 |
|
105 | 195 | ### Using with Agents |
106 | 196 |
|
|
0 commit comments