Skip to content

Commit 04b723c

Browse files
Address the PR comment
1 parent 23d0fe8 commit 04b723c

6 files changed

Lines changed: 26 additions & 20 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ tools = toolset.fetch_tools(actions=["workday_*"], account_ids=[account_id])
179179
langchain_tools = tools.to_langchain()
180180

181181
# Use with LangChain models
182-
model = ChatOpenAI(model="gpt-4o-mini")
182+
model = ChatOpenAI(model="gpt-5.4")
183183
model_with_tools = model.bind_tools(langchain_tools)
184184

185185
# Execute AI-driven tool calls
@@ -233,7 +233,7 @@ graph = StateGraph(State)
233233
graph.add_node("tools", to_tool_node(langchain_tools))
234234

235235
def call_llm(state: dict):
236-
llm = ChatOpenAI(model="gpt-4o-mini")
236+
llm = ChatOpenAI(model="gpt-5.4")
237237
llm = bind_model_with_tools(llm, langchain_tools)
238238
resp = llm.invoke(state["messages"]) # returns AIMessage with optional tool_calls
239239
return {"messages": state["messages"] + [resp]}
@@ -271,7 +271,7 @@ agent = Agent(
271271
goal="Analyze employee data and generate insights",
272272
backstory="Expert in HR analytics and employee management",
273273
tools=langchain_tools,
274-
llm="gpt-4o-mini"
274+
llm="gpt-5.4"
275275
)
276276

277277
# Define task and execute

examples/auth_management.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ def main() -> None:
8686
print("STACKONE_API_KEY is not set. Please export it or add it to .env")
8787
return
8888

89-
account_id = os.getenv("STACKONE_ACCOUNT_ID", "test-account-id")
89+
account_id = os.getenv("STACKONE_ACCOUNT_ID")
90+
if not account_id:
91+
print("Set STACKONE_ACCOUNT_ID to run this example.")
92+
return
9093

9194
api_key_setup()
9295
single_account(account_id)

examples/crewai_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ def crewai_integration():
4848
goal="List the first 5 employees in the company",
4949
backstory="With over 10 years of experience in HR and employee management, "
5050
"you excel at finding patterns in complex datasets.",
51-
llm="gpt-5.1",
51+
llm="gpt-5.4",
5252
tools=langchain_tools,
5353
max_iter=2,
5454
)
5555

5656
task = Task(
5757
description="List the first 5 employees in the company",
5858
agent=agent,
59-
expected_output="A JSON object containing the employee's information",
59+
expected_output="A list of the first 5 employees with their details",
6060
)
6161

6262
crew = Crew(agents=[agent], tasks=[task])

examples/langchain_integration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def langchain_integration() -> None:
3030
if not account_id:
3131
print("Set STACKONE_ACCOUNT_ID to run this example.")
3232
return
33+
if not os.getenv("OPENAI_API_KEY"):
34+
print("Set OPENAI_API_KEY to run this example.")
35+
return
3336

3437
toolset = StackOneToolSet()
3538
tools = toolset.fetch_tools(
@@ -44,7 +47,7 @@ def langchain_integration() -> None:
4447
print(f" - {tool.name}")
4548

4649
# Create model with tools
47-
model = ChatOpenAI(model="gpt-5.1")
50+
model = ChatOpenAI(model="gpt-5.4")
4851
model_with_tools = model.bind_tools(langchain_tools)
4952

5053
result = model_with_tools.invoke("List the first 5 employees")

examples/openai_integration.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from __future__ import annotations
1313

14+
import json
1415
import os
1516

1617
try:
@@ -67,7 +68,7 @@ def openai_integration() -> None:
6768
]
6869

6970
response = client.chat.completions.create(
70-
model="gpt-5.1",
71+
model="gpt-5.4",
7172
messages=messages,
7273
tools=openai_tools,
7374
tool_choice="auto",
@@ -88,20 +89,19 @@ def openai_integration() -> None:
8889
for i, result in enumerate(results):
8990
print(f" Result {i + 1}: {str(result)[:200]}...")
9091

91-
# Continue the conversation with the results
92-
messages.extend(
93-
[
94-
{"role": "assistant", "content": None, "tool_calls": tool_calls},
92+
# Continue the conversation with all tool call results
93+
messages.append(response.choices[0].message.model_dump(exclude_none=True))
94+
for tc, result in zip(tool_calls, results):
95+
messages.append(
9596
{
9697
"role": "tool",
97-
"tool_call_id": tool_calls[0].id,
98-
"content": str(results[0]),
99-
},
100-
]
101-
)
98+
"tool_call_id": tc.id,
99+
"content": json.dumps(result),
100+
}
101+
)
102102

103103
final_response = client.chat.completions.create(
104-
model="gpt-5.1",
104+
model="gpt-5.4",
105105
messages=messages,
106106
tools=openai_tools,
107107
tool_choice="auto",

examples/search_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def search_and_execute(account_id: str) -> None:
119119

120120
for step in range(5):
121121
response = client.chat.completions.create(
122-
model="gpt-5.1",
122+
model="gpt-5.4",
123123
messages=messages,
124124
tools=openai_tools,
125125
tool_choice="auto",
@@ -131,7 +131,7 @@ def search_and_execute(account_id: str) -> None:
131131
break
132132

133133
# Append the assistant message (with tool calls) to history
134-
messages.append({"role": "assistant", "content": message.content, "tool_calls": message.tool_calls})
134+
messages.append(message.model_dump(exclude_none=True))
135135

136136
for tool_call in message.tool_calls:
137137
name = tool_call.function.name

0 commit comments

Comments
 (0)