Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions splunklib/ai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1020,10 +1020,10 @@ or excessive token usage.
| `max_tokens` | 200 000 tokens | token count of messages passed to the model |
| `max_steps` | 100 steps | number of messages in the conversation |
| `timeout` | 600 seconds (10 minutes) | per `invoke` call |
| `max_structured_output_retires` | 3 retries | per `invoke` call |
| `max_structured_output_retries` | 3 retries | per `invoke` call |

`max_tokens` and `max_steps` are checked against the messages passed to the model on each call.
`timeout` and `max_structured_output_retires` reset on each `invoke`, so they limit only the
`timeout` and `max_structured_output_retries` reset on each `invoke`, so they limit only the
current agent loop invocation.

When a limit is exceeded, the agent raises the corresponding exception:
Expand Down Expand Up @@ -1053,7 +1053,7 @@ async with Agent(
max_tokens=50_000,
max_steps=10,
timeout=30.0,
max_structured_output_retires=0, # no retries
max_structured_output_retries=0, # no retries
),
) as agent: ...
```
Expand Down
8 changes: 4 additions & 4 deletions splunklib/ai/engines/langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ def __init__(self, agent: BaseAgent[OutputT]) -> None:
before_user_middlewares, after_user_middlewares = _debugging_middleware(agent.logger)

self._agent_middleware: list[AgentMiddleware] = []
if agent.limits.max_structured_output_retires is not None:
if agent.limits.max_structured_output_retries is not None:
self._agent_middleware.append(
_StructuredOutputRetryLimitMiddleware(agent.limits.max_structured_output_retires)
_StructuredOutputRetryLimitMiddleware(agent.limits.max_structured_output_retries)
)

self._agent_middleware.extend(before_user_middlewares)
Expand Down Expand Up @@ -418,7 +418,7 @@ class _SubagentArgumentPacker(LC_AgentMiddleware):
# to differentiate that we wrap the resulting args in an SubagentLCArgs.
#
# This middleware performs the corresponding pack/unpack at the two
# points in the LangChain call graph where raw args are needed/retreived.
# points in the LangChain call graph where raw args are needed/retrieved.
#
# TODO: we could move this logic to _Middleware.
@override
Expand Down Expand Up @@ -2052,7 +2052,7 @@ async def model_middleware(

class _StructuredOutputRetryLimitMiddleware(AgentMiddleware):
"""Stops agent execution when the agent exceeds structured output
retry limit during a single agent loop invocation. Pass 0 to disable retires.
retry limit during a single agent loop invocation. Pass 0 to disable retries.
"""

_limit: int
Expand Down
2 changes: 1 addition & 1 deletion splunklib/ai/limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AgentLimits:
Raises `TokenLimitExceededException` when exceeded.
"""

max_structured_output_retires: int | None = DEFAULT_STRUCTURED_OUTPUT_RETRY_LIMIT
max_structured_output_retries: int | None = DEFAULT_STRUCTURED_OUTPUT_RETRY_LIMIT
"""Maximum number of structured output generation retries allowed
within a single `invoke` call.
Raises `StructuredOutputRetryLimitExceededException` when exceeded.
Expand Down
2 changes: 1 addition & 1 deletion splunklib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,7 @@ def delete(self, key):
def _entity_path(self, state):
# Overridden to make all the ConfigurationFile objects
# returned refer to the configs/ path instead of the
# properties/ path used by Configrations.
# properties/ path used by Configurations.
return PATH_CONF % state["title"]


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ai/test_structured_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ async def _model_middleware(
system_prompt="Respond with structured data",
output_schema=Person,
service=self.service,
limits=AgentLimits(max_structured_output_retires=limit),
limits=AgentLimits(max_structured_output_retries=limit),
middleware=[
_model_middleware,
],
Expand Down
Loading