Skip to content

Commit 6410ad9

Browse files
committed
Set kw_only=True in all dataclasses
1 parent 140d162 commit 6410ad9

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

splunklib/ai/middleware.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
)
3131

3232

33-
@dataclass(frozen=True)
33+
@dataclass(frozen=True, kw_only=True)
3434
class AgentState:
3535
"""AgentState is available through certain middlewares and contains information about the current state of an agent execution."""
3636

@@ -42,7 +42,7 @@ class AgentState:
4242
token_count: int
4343

4444

45-
@dataclass(frozen=True)
45+
@dataclass(frozen=True, kw_only=True)
4646
class ToolRequest:
4747
call: ToolCall
4848
state: AgentState

splunklib/ai/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
import httpx
1919

2020

21-
@dataclass(frozen=True)
21+
@dataclass(frozen=True, kw_only=True)
2222
class PredefinedModel:
2323
"""Base class for models that are predefined in the SDK"""
2424

2525
model: str
2626

2727

28-
@dataclass(frozen=True)
28+
@dataclass(frozen=True, kw_only=True)
2929
class OpenAIModel(PredefinedModel):
3030
"""Predefined OpenAI Model"""
3131

@@ -53,7 +53,7 @@ class OpenAIModel(PredefinedModel):
5353
"""
5454

5555

56-
@dataclass(frozen=True)
56+
@dataclass(frozen=True, kw_only=True)
5757
class AnthropicModel(PredefinedModel):
5858
"""Predefined Anthropic Model"""
5959

splunklib/ai/structured_output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
from splunklib.ai.messages import AIMessage
1818

1919

20-
@dataclass(frozen=True)
20+
@dataclass(frozen=True, kw_only=True)
2121
class StructuredOutputMultipleToolCallsError:
2222
pass
2323

2424

25-
@dataclass(frozen=True)
25+
@dataclass(frozen=True, kw_only=True)
2626
class StructuredOutputValidationError:
2727
validation_error: str
2828

splunklib/ai/tool_settings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from splunklib.ai.tools import ToolMetadata
1919

2020

21-
@dataclass(frozen=True)
21+
@dataclass(frozen=True, kw_only=True)
2222
class ToolAllowlist:
2323
"""Holds tool names and tags allowed to be used by Agents.
2424
@@ -41,17 +41,17 @@ def is_allowed(self, tool: ToolMetadata) -> bool:
4141
return self.custom_predicate(tool) if self.custom_predicate else False
4242

4343

44-
@dataclass(frozen=True)
44+
@dataclass(frozen=True, kw_only=True)
4545
class RemoteToolSettings:
4646
allowlist: ToolAllowlist
4747

4848

49-
@dataclass(frozen=True)
49+
@dataclass(frozen=True, kw_only=True)
5050
class LocalToolSettings:
5151
allowlist: ToolAllowlist
5252

5353

54-
@dataclass(frozen=True)
54+
@dataclass(frozen=True, kw_only=True)
5555
class ToolSettings:
5656
local: LocalToolSettings | bool
5757
"""Controls local tool loading (via ``bin/tools.py``).

splunklib/ai/tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ToolException(Exception):
3838
"""Custom exception to indicate tool execution errors."""
3939

4040

41-
@dataclass(frozen=True)
41+
@dataclass(frozen=True, kw_only=True)
4242
class ToolResult:
4343
content: str
4444
structured_content: dict[str, Any] | None
@@ -49,7 +49,7 @@ class ToolType(Enum):
4949
REMOTE = "remote"
5050

5151

52-
@dataclass(frozen=True)
52+
@dataclass(frozen=True, kw_only=True)
5353
class ToolMetadata:
5454
name: str
5555
description: str
@@ -58,7 +58,7 @@ class ToolMetadata:
5858
tags: list[str]
5959

6060

61-
@dataclass(frozen=True)
61+
@dataclass(frozen=True, kw_only=True)
6262
class Tool(ToolMetadata):
6363
func: Callable[..., Awaitable[ToolResult]]
6464

0 commit comments

Comments
 (0)