Skip to content

Commit 5b62cc4

Browse files
committed
fix: use messages in the schema
1 parent abdd516 commit 5b62cc4

14 files changed

Lines changed: 49 additions & 39 deletions

File tree

packages/uipath-openai-agents/docs/quick_start.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Generate your first UiPath OpenAI agent:
106106
✓ Created 'pyproject.toml' file.
107107
🔧 Please ensure to define OPENAI_API_KEY in your .env file.
108108
💡 Initialize project: uipath init
109-
💡 Run agent: uipath run agent '{"message": "Hello"}'
109+
💡 Run agent: uipath run agent '{"messages": "Hello"}'
110110
```
111111

112112
This command creates the following files:
@@ -173,7 +173,7 @@ Execute the agent with a sample input:
173173
<!-- termynal -->
174174

175175
```shell
176-
> uipath run agent '{"message": "Hello"}'
176+
> uipath run agent '{"messages": "Hello"}'
177177
{'response': 'Hello! How can I help you today?', 'agent_used': 'main'}
178178
✓ Successful execution.
179179
```
@@ -185,19 +185,19 @@ Depending on the shell you are using, it may be necessary to escape the input js
185185

186186
/// tab | Bash/ZSH/PowerShell
187187
```console
188-
uipath run agent '{"message": "Hello"}'
188+
uipath run agent '{"messages": "Hello"}'
189189
```
190190
///
191191

192192
/// tab | Windows CMD
193193
```console
194-
uipath run agent "{""message"": ""Hello""}"
194+
uipath run agent "{""messages"": ""Hello""}"
195195
```
196196
///
197197

198198
/// tab | Windows PowerShell
199199
```console
200-
uipath run agent '{\"message\":\"Hello\"}'
200+
uipath run agent '{\"messages\":\"Hello\"}'
201201
```
202202
///
203203

@@ -215,7 +215,7 @@ The `run` command can also take a .json file as an input. You can create a file
215215

216216
```json
217217
{
218-
"message": "Hello"
218+
"messages": "Hello"
219219
}
220220
```
221221

@@ -275,7 +275,7 @@ Set the environment variables using the provided link.
275275
<!-- termynal -->
276276

277277
```shell
278-
> uipath invoke agent '{"message": "Hello"}'
278+
> uipath invoke agent '{"messages": "Hello"}'
279279
⠴ Loading configuration ...
280280
⠴ Starting job ...
281281
✨ Job started successfully!
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"message": "Tell me a joke"
2+
"messages": "Tell me a joke"
33
}

packages/uipath-openai-agents/samples/rag-assistant/entry-points.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"input": {
1010
"type": "object",
1111
"properties": {
12-
"message": {
12+
"messages": {
1313
"anyOf": [
1414
{
1515
"type": "string"
@@ -21,12 +21,12 @@
2121
}
2222
}
2323
],
24-
"title": "Message",
25-
"description": "User message(s) to send to the agent"
24+
"title": "Messages",
25+
"description": "User messages to send to the agent"
2626
}
2727
},
2828
"required": [
29-
"message"
29+
"messages"
3030
]
3131
},
3232
"output": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"message": "Who is the best ai llm?"
2+
"messages": "Who is the best ai llm?"
33
}

packages/uipath-openai-agents/samples/triage-agent/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ In this pattern:
2929

3030
```bash
3131
# Spanish message
32-
uipath run main '{"message": "Hola, ¿cómo estás?"}'
32+
uipath run main '{"messages": "Hola, ¿cómo estás?"}'
3333

3434
# French message
35-
uipath run main '{"message": "Bonjour, comment allez-vous?"}'
35+
uipath run main '{"messages": "Bonjour, comment allez-vous?"}'
3636

3737
# English message
38-
uipath run main '{"message": "Hello, how are you?"}'
38+
uipath run main '{"messages": "Hello, how are you?"}'
3939
```
4040

4141
### Configure in openai_agents.json
@@ -53,7 +53,7 @@ uipath run main '{"message": "Hello, how are you?"}'
5353
### Input
5454
```python
5555
class Input(BaseModel):
56-
message: str # User message in any language
56+
messages: str # User message in any language
5757
```
5858

5959
### Output
@@ -66,7 +66,7 @@ class Output(BaseModel):
6666
## Example Execution
6767

6868
```bash
69-
$ uipath run main '{"message": "Hola, ¿cómo estás?"}'
69+
$ uipath run main '{"messages": "Hola, ¿cómo estás?"}'
7070

7171
Processing message: Hola, ¿cómo estás?
7272
¡Hola! Estoy muy bien, gracias. ¿Y tú, cómo estás?

packages/uipath-openai-agents/samples/triage-agent/entry-points.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"input": {
1010
"type": "object",
1111
"properties": {
12-
"message": {
12+
"messages": {
1313
"anyOf": [
1414
{
1515
"type": "string"
@@ -21,12 +21,12 @@
2121
}
2222
}
2323
],
24-
"title": "Message",
25-
"description": "User message(s) to send to the agent"
24+
"title": "Messages",
25+
"description": "User messages to send to the agent"
2626
}
2727
},
2828
"required": [
29-
"message"
29+
"messages"
3030
]
3131
},
3232
"output": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"message": "une blague."
2+
"messages": "une blague."
33
}

packages/uipath-openai-agents/src/uipath_openai_agents/_cli/_templates/AGENTS.md.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ This documentation is split into multiple files for efficient context loading. L
1818

1919
3. **@.agent/CLI_REFERENCE.md** - CLI commands documentation
2020
- **When to load:** Working with `uipath init`, `uipath run agent`, or deployment commands
21-
- **Contains:** Command syntax for OpenAI agents, options, input formats (`{"message": "..."}` or `{"messages": [...]}`), debug mode, usage examples
21+
- **Contains:** Command syntax for OpenAI agents, options, input formats (`{"messages": "..."}` or `{"messages": [...]}`), debug mode, usage examples

packages/uipath-openai-agents/src/uipath_openai_agents/_cli/cli_new.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def openai_agents_new_middleware(name: str) -> MiddlewareResult:
6363
generate_pyproject(directory, name)
6464
console.success("Created 'pyproject.toml' file.")
6565
init_command = """uipath init"""
66-
run_command = """uipath run agent '{"message": "What is the weather in San Francisco?"}'"""
66+
run_command = """uipath run agent '{"messages": "What is the weather in San Francisco?"}'"""
6767
console.hint(
6868
f""" Initialize project: {click.style(init_command, fg="cyan")}"""
6969
)

packages/uipath-openai-agents/src/uipath_openai_agents/runtime/runtime.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,20 @@ def _convert_stream_event_to_runtime_event(
219219
return None
220220

221221
def _prepare_agent_input(self, input: dict[str, Any] | None) -> str | list[Any]:
222-
"""Prepare agent input from UiPath input dictionary."""
223-
if input and "messages" in input and isinstance(input["messages"], list):
224-
return input.get("messages", [])
225-
return input.get("message", "") if input else ""
222+
"""
223+
Prepare agent input from UiPath input dictionary.
224+
225+
"""
226+
if not input:
227+
return ""
228+
229+
messages = input.get("messages", "")
230+
231+
if isinstance(messages, (str, list)):
232+
return messages
233+
234+
# Fallback to empty string for unexpected types
235+
return ""
226236

227237
def _serialize_message(self, message: Any) -> dict[str, Any]:
228238
"""

0 commit comments

Comments
 (0)