Skip to content

Commit 05f689b

Browse files
genai-function-calling: update openai-agents and expectations to ES 9.x (#91)
Signed-off-by: Adrian Cole <[email protected]>
1 parent 577c259 commit 05f689b

File tree

14 files changed

+1895
-332
lines changed

14 files changed

+1895
-332
lines changed

genai-function-calling/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ performs the same process. The user asks a question that is beyond the training
2727
date of the LLM. The application uses the framework to implement an agent
2828
pattern to automatically call functions when it needs new information.
2929

30-
Here's how the question "What is the latest version of Elasticsearch 8?" ends up
30+
Here's how the question "What is the latest version of Elasticsearch 9?" ends up
3131
being answered.
3232

3333
```mermaid
@@ -36,23 +36,23 @@ sequenceDiagram
3636
participant LLM
3737
3838
Note over Agent: Framework sends its tools along with the prompt
39-
Agent ->> LLM: user: "What is the latest version of Elasticsearch 8?"
39+
Agent ->> LLM: user: "What is the latest version of Elasticsearch 9?"
4040
activate LLM
4141
Note over LLM: LLM determines it needs to use a tool to complete the task
4242
43-
LLM ->> Agent: assistant: {"function": {"name": "get_latest_elasticsearch_version", "arguments": "{\"majorVersion\": 8}"}}
43+
LLM ->> Agent: assistant: {"function": {"name": "get_latest_elasticsearch_version", "arguments": "{\"majorVersion\": 9}"}}
4444
deactivate LLM
4545
activate Agent
46-
Note over Agent: invokes get_latest_elasticsearch_version(majorVersion=8)
46+
Note over Agent: invokes get_latest_elasticsearch_version(majorVersion=9)
4747
48-
Agent ->> LLM: [user, assistant, tool: "8.19.3"]
48+
Agent ->> LLM: [user, assistant, tool: "9.1.5"]
4949
Note over Agent: LLM is stateless, the tool result is sent back with prior messages
5050
deactivate Agent
5151
activate LLM
5252
53-
LLM ->> Agent: content: "The latest version of Elasticsearch 8 is 8.19.3"
53+
LLM ->> Agent: content: "The latest version of Elasticsearch 9 is 9.1.5"
5454
deactivate LLM
55-
Note over Agent: "The latest version of Elasticsearch 8 is 8.19.3"
55+
Note over Agent: "The latest version of Elasticsearch 9 is 9.1.5"
5656
```
5757

5858
The GenAI framework not only abstracts the above loop, but also LLM plugability
@@ -173,21 +173,21 @@ sequenceDiagram
173173
174174
create participant LLM
175175
176-
Agent->>LLM: user: "What is the latest version of Elasticsearch 8?"
176+
Agent->>LLM: user: "What is the latest version of Elasticsearch 9?"
177177
activate LLM
178-
LLM->>Agent: assistant: {"function": {"name": "get_latest_elasticsearch_version", "arguments": "{\"majorVersion\": 8}"}}
178+
LLM->>Agent: assistant: {"function": {"name": "get_latest_elasticsearch_version", "arguments": "{\"majorVersion\": 9}"}}
179179
deactivate LLM
180180
activate Agent
181181
182182
rect rgb(191, 223, 255)
183-
Agent->>+MCP: tools/call: {get_latest_elasticsearch_version, {majorVersion: 8}}
184-
MCP-->>-Agent: response: {output: "8.19.3"}
183+
Agent->>+MCP: tools/call: {get_latest_elasticsearch_version, {majorVersion: 9}}
184+
MCP-->>-Agent: response: {output: "9.1.5"}
185185
end
186186
187-
Agent->>LLM: [user, assistant, tool: "8.19.3"]
187+
Agent->>LLM: [user, assistant, tool: "9.1.5"]
188188
deactivate Agent
189189
activate LLM
190-
LLM->>Agent: content: "The latest version of Elasticsearch 8 is 8.19.3"
190+
LLM->>Agent: content: "The latest version of Elasticsearch 9 is 9.1.5"
191191
deactivate LLM
192192
```
193193

genai-function-calling/openai-agents/Dockerfile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Use glibc-based image with pre-compiled wheels for psutil
22
FROM python:3.13-slim
33

4-
# TODO: temporary until elastic-opentelemetry release with https://github.com/elastic/elastic-otel-python-instrumentations/pull/90
5-
RUN apt-get update \
6-
&& apt-get install -y --no-install-recommends git \
7-
&& apt-get clean \
8-
&& rm -rf /var/lib/apt/lists/*
9-
104
RUN --mount=type=cache,target=/root/.cache/pip python -m pip install --upgrade pip
115

126
COPY requirements.txt /tmp

genai-function-calling/openai-agents/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ dotenv -f .env run -- pytest
8787
## Notes
8888

8989
The LLM should generate something like "The latest stable version of
90-
Elasticsearch is 8.19.3", unless it hallucinates. Just run it again, if you
90+
Elasticsearch is 9.1.5", unless it hallucinates. Just run it again, if you
9191
see something else.
9292

9393
OpenAI Agents SDK's OpenTelemetry instrumentation is via

0 commit comments

Comments
 (0)