mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-05-04 07:20:31 +00:00
feat(api): manual updates
This commit is contained in:
parent
d4ab769b98
commit
64c9b57dda
34 changed files with 305 additions and 477 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
configured_endpoints: 20
|
configured_endpoints: 20
|
||||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-945f9da9e9a4c4008834deef63e4346c0076e020eed3d3c98c249095033c1ac5.yml
|
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-15eeb028f79b9a065b4e54a6ea6a58631e9bd5004f97820f0c79d18e3f8bac84.yml
|
||||||
openapi_spec_hash: 522a44f6cb0677435fe2ac7693848ad7
|
openapi_spec_hash: 38c8bacb6c8e4c46852a3e81e3fb9fda
|
||||||
config_hash: 6c8822d278ba83456e5eed6d774ca230
|
config_hash: 348a85e725de595ca05a61f4333794ac
|
||||||
|
|
|
||||||
17
api.md
17
api.md
|
|
@ -83,18 +83,19 @@ Types:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from opencode_ai.types import (
|
from opencode_ai.types import (
|
||||||
|
AssistantMessage,
|
||||||
|
AssistantMessagePart,
|
||||||
FilePart,
|
FilePart,
|
||||||
Message,
|
Message,
|
||||||
MessagePart,
|
|
||||||
ReasoningPart,
|
|
||||||
Session,
|
Session,
|
||||||
SourceURLPart,
|
|
||||||
StepStartPart,
|
StepStartPart,
|
||||||
TextPart,
|
TextPart,
|
||||||
ToolCall,
|
ToolPart,
|
||||||
ToolInvocationPart,
|
ToolStateCompleted,
|
||||||
ToolPartialCall,
|
ToolStateError,
|
||||||
ToolResult,
|
ToolStatePending,
|
||||||
|
ToolStateRunning,
|
||||||
|
UserMessagePart,
|
||||||
SessionListResponse,
|
SessionListResponse,
|
||||||
SessionDeleteResponse,
|
SessionDeleteResponse,
|
||||||
SessionAbortResponse,
|
SessionAbortResponse,
|
||||||
|
|
@ -110,7 +111,7 @@ Methods:
|
||||||
- <code title="get /session">client.session.<a href="./src/opencode_ai/resources/session.py">list</a>() -> <a href="./src/opencode_ai/types/session_list_response.py">SessionListResponse</a></code>
|
- <code title="get /session">client.session.<a href="./src/opencode_ai/resources/session.py">list</a>() -> <a href="./src/opencode_ai/types/session_list_response.py">SessionListResponse</a></code>
|
||||||
- <code title="delete /session/{id}">client.session.<a href="./src/opencode_ai/resources/session.py">delete</a>(id) -> <a href="./src/opencode_ai/types/session_delete_response.py">SessionDeleteResponse</a></code>
|
- <code title="delete /session/{id}">client.session.<a href="./src/opencode_ai/resources/session.py">delete</a>(id) -> <a href="./src/opencode_ai/types/session_delete_response.py">SessionDeleteResponse</a></code>
|
||||||
- <code title="post /session/{id}/abort">client.session.<a href="./src/opencode_ai/resources/session.py">abort</a>(id) -> <a href="./src/opencode_ai/types/session_abort_response.py">SessionAbortResponse</a></code>
|
- <code title="post /session/{id}/abort">client.session.<a href="./src/opencode_ai/resources/session.py">abort</a>(id) -> <a href="./src/opencode_ai/types/session_abort_response.py">SessionAbortResponse</a></code>
|
||||||
- <code title="post /session/{id}/message">client.session.<a href="./src/opencode_ai/resources/session.py">chat</a>(id, \*\*<a href="src/opencode_ai/types/session_chat_params.py">params</a>) -> <a href="./src/opencode_ai/types/message.py">Message</a></code>
|
- <code title="post /session/{id}/message">client.session.<a href="./src/opencode_ai/resources/session.py">chat</a>(id, \*\*<a href="src/opencode_ai/types/session_chat_params.py">params</a>) -> <a href="./src/opencode_ai/types/assistant_message.py">AssistantMessage</a></code>
|
||||||
- <code title="post /session/{id}/init">client.session.<a href="./src/opencode_ai/resources/session.py">init</a>(id, \*\*<a href="src/opencode_ai/types/session_init_params.py">params</a>) -> <a href="./src/opencode_ai/types/session_init_response.py">SessionInitResponse</a></code>
|
- <code title="post /session/{id}/init">client.session.<a href="./src/opencode_ai/resources/session.py">init</a>(id, \*\*<a href="src/opencode_ai/types/session_init_params.py">params</a>) -> <a href="./src/opencode_ai/types/session_init_response.py">SessionInitResponse</a></code>
|
||||||
- <code title="get /session/{id}/message">client.session.<a href="./src/opencode_ai/resources/session.py">messages</a>(id) -> <a href="./src/opencode_ai/types/session_messages_response.py">SessionMessagesResponse</a></code>
|
- <code title="get /session/{id}/message">client.session.<a href="./src/opencode_ai/resources/session.py">messages</a>(id) -> <a href="./src/opencode_ai/types/session_messages_response.py">SessionMessagesResponse</a></code>
|
||||||
- <code title="post /session/{id}/share">client.session.<a href="./src/opencode_ai/resources/session.py">share</a>(id) -> <a href="./src/opencode_ai/types/session.py">Session</a></code>
|
- <code title="post /session/{id}/share">client.session.<a href="./src/opencode_ai/resources/session.py">share</a>(id) -> <a href="./src/opencode_ai/types/session.py">Session</a></code>
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,13 @@ from .._response import (
|
||||||
async_to_streamed_response_wrapper,
|
async_to_streamed_response_wrapper,
|
||||||
)
|
)
|
||||||
from .._base_client import make_request_options
|
from .._base_client import make_request_options
|
||||||
from ..types.message import Message
|
|
||||||
from ..types.session import Session
|
from ..types.session import Session
|
||||||
from ..types.message_part_param import MessagePartParam
|
from ..types.assistant_message import AssistantMessage
|
||||||
from ..types.session_init_response import SessionInitResponse
|
from ..types.session_init_response import SessionInitResponse
|
||||||
from ..types.session_list_response import SessionListResponse
|
from ..types.session_list_response import SessionListResponse
|
||||||
from ..types.session_abort_response import SessionAbortResponse
|
from ..types.session_abort_response import SessionAbortResponse
|
||||||
from ..types.session_delete_response import SessionDeleteResponse
|
from ..types.session_delete_response import SessionDeleteResponse
|
||||||
|
from ..types.user_message_part_param import UserMessagePartParam
|
||||||
from ..types.session_messages_response import SessionMessagesResponse
|
from ..types.session_messages_response import SessionMessagesResponse
|
||||||
from ..types.session_summarize_response import SessionSummarizeResponse
|
from ..types.session_summarize_response import SessionSummarizeResponse
|
||||||
|
|
||||||
|
|
@ -160,7 +160,7 @@ class SessionResource(SyncAPIResource):
|
||||||
id: str,
|
id: str,
|
||||||
*,
|
*,
|
||||||
model_id: str,
|
model_id: str,
|
||||||
parts: Iterable[MessagePartParam],
|
parts: Iterable[UserMessagePartParam],
|
||||||
provider_id: str,
|
provider_id: str,
|
||||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||||
|
|
@ -168,7 +168,7 @@ class SessionResource(SyncAPIResource):
|
||||||
extra_query: Query | None = None,
|
extra_query: Query | None = None,
|
||||||
extra_body: Body | None = None,
|
extra_body: Body | None = None,
|
||||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||||
) -> Message:
|
) -> AssistantMessage:
|
||||||
"""
|
"""
|
||||||
Create and send a new message to a session
|
Create and send a new message to a session
|
||||||
|
|
||||||
|
|
@ -198,7 +198,7 @@ class SessionResource(SyncAPIResource):
|
||||||
options=make_request_options(
|
options=make_request_options(
|
||||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||||
),
|
),
|
||||||
cast_to=Message,
|
cast_to=AssistantMessage,
|
||||||
)
|
)
|
||||||
|
|
||||||
def init(
|
def init(
|
||||||
|
|
@ -520,7 +520,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
||||||
id: str,
|
id: str,
|
||||||
*,
|
*,
|
||||||
model_id: str,
|
model_id: str,
|
||||||
parts: Iterable[MessagePartParam],
|
parts: Iterable[UserMessagePartParam],
|
||||||
provider_id: str,
|
provider_id: str,
|
||||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||||
|
|
@ -528,7 +528,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
||||||
extra_query: Query | None = None,
|
extra_query: Query | None = None,
|
||||||
extra_body: Body | None = None,
|
extra_body: Body | None = None,
|
||||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||||
) -> Message:
|
) -> AssistantMessage:
|
||||||
"""
|
"""
|
||||||
Create and send a new message to a session
|
Create and send a new message to a session
|
||||||
|
|
||||||
|
|
@ -558,7 +558,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
||||||
options=make_request_options(
|
options=make_request_options(
|
||||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||||
),
|
),
|
||||||
cast_to=Message,
|
cast_to=AssistantMessage,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def init(
|
async def init(
|
||||||
|
|
|
||||||
|
|
@ -13,43 +13,37 @@ from .provider import Provider as Provider
|
||||||
from .file_part import FilePart as FilePart
|
from .file_part import FilePart as FilePart
|
||||||
from .mcp_local import McpLocal as McpLocal
|
from .mcp_local import McpLocal as McpLocal
|
||||||
from .text_part import TextPart as TextPart
|
from .text_part import TextPart as TextPart
|
||||||
from .tool_call import ToolCall as ToolCall
|
from .tool_part import ToolPart as ToolPart
|
||||||
from .mcp_remote import McpRemote as McpRemote
|
from .mcp_remote import McpRemote as McpRemote
|
||||||
from .tool_result import ToolResult as ToolResult
|
|
||||||
from .message_part import MessagePart as MessagePart
|
|
||||||
from .reasoning_part import ReasoningPart as ReasoningPart
|
|
||||||
from .file_part_param import FilePartParam as FilePartParam
|
from .file_part_param import FilePartParam as FilePartParam
|
||||||
from .source_url_part import SourceURLPart as SourceURLPart
|
|
||||||
from .step_start_part import StepStartPart as StepStartPart
|
from .step_start_part import StepStartPart as StepStartPart
|
||||||
from .text_part_param import TextPartParam as TextPartParam
|
from .text_part_param import TextPartParam as TextPartParam
|
||||||
from .tool_call_param import ToolCallParam as ToolCallParam
|
|
||||||
from .file_read_params import FileReadParams as FileReadParams
|
from .file_read_params import FileReadParams as FileReadParams
|
||||||
from .find_text_params import FindTextParams as FindTextParams
|
from .find_text_params import FindTextParams as FindTextParams
|
||||||
|
from .tool_state_error import ToolStateError as ToolStateError
|
||||||
from .app_init_response import AppInitResponse as AppInitResponse
|
from .app_init_response import AppInitResponse as AppInitResponse
|
||||||
|
from .assistant_message import AssistantMessage as AssistantMessage
|
||||||
from .find_files_params import FindFilesParams as FindFilesParams
|
from .find_files_params import FindFilesParams as FindFilesParams
|
||||||
from .tool_partial_call import ToolPartialCall as ToolPartialCall
|
from .user_message_part import UserMessagePart as UserMessagePart
|
||||||
from .tool_result_param import ToolResultParam as ToolResultParam
|
|
||||||
from .file_read_response import FileReadResponse as FileReadResponse
|
from .file_read_response import FileReadResponse as FileReadResponse
|
||||||
from .find_text_response import FindTextResponse as FindTextResponse
|
from .find_text_response import FindTextResponse as FindTextResponse
|
||||||
from .message_part_param import MessagePartParam as MessagePartParam
|
from .tool_state_pending import ToolStatePending as ToolStatePending
|
||||||
|
from .tool_state_running import ToolStateRunning as ToolStateRunning
|
||||||
from .event_list_response import EventListResponse as EventListResponse
|
from .event_list_response import EventListResponse as EventListResponse
|
||||||
from .find_files_response import FindFilesResponse as FindFilesResponse
|
from .find_files_response import FindFilesResponse as FindFilesResponse
|
||||||
from .find_symbols_params import FindSymbolsParams as FindSymbolsParams
|
from .find_symbols_params import FindSymbolsParams as FindSymbolsParams
|
||||||
from .session_chat_params import SessionChatParams as SessionChatParams
|
from .session_chat_params import SessionChatParams as SessionChatParams
|
||||||
from .session_init_params import SessionInitParams as SessionInitParams
|
from .session_init_params import SessionInitParams as SessionInitParams
|
||||||
from .file_status_response import FileStatusResponse as FileStatusResponse
|
from .file_status_response import FileStatusResponse as FileStatusResponse
|
||||||
from .reasoning_part_param import ReasoningPartParam as ReasoningPartParam
|
from .tool_state_completed import ToolStateCompleted as ToolStateCompleted
|
||||||
from .tool_invocation_part import ToolInvocationPart as ToolInvocationPart
|
|
||||||
from .find_symbols_response import FindSymbolsResponse as FindSymbolsResponse
|
from .find_symbols_response import FindSymbolsResponse as FindSymbolsResponse
|
||||||
from .session_init_response import SessionInitResponse as SessionInitResponse
|
from .session_init_response import SessionInitResponse as SessionInitResponse
|
||||||
from .session_list_response import SessionListResponse as SessionListResponse
|
from .session_list_response import SessionListResponse as SessionListResponse
|
||||||
from .source_url_part_param import SourceURLPartParam as SourceURLPartParam
|
from .assistant_message_part import AssistantMessagePart as AssistantMessagePart
|
||||||
from .step_start_part_param import StepStartPartParam as StepStartPartParam
|
|
||||||
from .session_abort_response import SessionAbortResponse as SessionAbortResponse
|
from .session_abort_response import SessionAbortResponse as SessionAbortResponse
|
||||||
from .session_delete_response import SessionDeleteResponse as SessionDeleteResponse
|
from .session_delete_response import SessionDeleteResponse as SessionDeleteResponse
|
||||||
from .tool_partial_call_param import ToolPartialCallParam as ToolPartialCallParam
|
from .user_message_part_param import UserMessagePartParam as UserMessagePartParam
|
||||||
from .session_summarize_params import SessionSummarizeParams as SessionSummarizeParams
|
from .session_summarize_params import SessionSummarizeParams as SessionSummarizeParams
|
||||||
from .config_providers_response import ConfigProvidersResponse as ConfigProvidersResponse
|
from .config_providers_response import ConfigProvidersResponse as ConfigProvidersResponse
|
||||||
from .session_messages_response import SessionMessagesResponse as SessionMessagesResponse
|
from .session_messages_response import SessionMessagesResponse as SessionMessagesResponse
|
||||||
from .session_summarize_response import SessionSummarizeResponse as SessionSummarizeResponse
|
from .session_summarize_response import SessionSummarizeResponse as SessionSummarizeResponse
|
||||||
from .tool_invocation_part_param import ToolInvocationPartParam as ToolInvocationPartParam
|
|
||||||
|
|
|
||||||
81
src/opencode_ai/types/assistant_message.py
Normal file
81
src/opencode_ai/types/assistant_message.py
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from typing import List, Union, Optional
|
||||||
|
from typing_extensions import Literal, Annotated, TypeAlias
|
||||||
|
|
||||||
|
from pydantic import Field as FieldInfo
|
||||||
|
|
||||||
|
from .._utils import PropertyInfo
|
||||||
|
from .._models import BaseModel
|
||||||
|
from .shared.unknown_error import UnknownError
|
||||||
|
from .assistant_message_part import AssistantMessagePart
|
||||||
|
from .shared.provider_auth_error import ProviderAuthError
|
||||||
|
|
||||||
|
__all__ = ["AssistantMessage", "Path", "Time", "Tokens", "TokensCache", "Error", "ErrorMessageOutputLengthError"]
|
||||||
|
|
||||||
|
|
||||||
|
class Path(BaseModel):
|
||||||
|
cwd: str
|
||||||
|
|
||||||
|
root: str
|
||||||
|
|
||||||
|
|
||||||
|
class Time(BaseModel):
|
||||||
|
created: float
|
||||||
|
|
||||||
|
completed: Optional[float] = None
|
||||||
|
|
||||||
|
|
||||||
|
class TokensCache(BaseModel):
|
||||||
|
read: float
|
||||||
|
|
||||||
|
write: float
|
||||||
|
|
||||||
|
|
||||||
|
class Tokens(BaseModel):
|
||||||
|
cache: TokensCache
|
||||||
|
|
||||||
|
input: float
|
||||||
|
|
||||||
|
output: float
|
||||||
|
|
||||||
|
reasoning: float
|
||||||
|
|
||||||
|
|
||||||
|
class ErrorMessageOutputLengthError(BaseModel):
|
||||||
|
data: object
|
||||||
|
|
||||||
|
name: Literal["MessageOutputLengthError"]
|
||||||
|
|
||||||
|
|
||||||
|
Error: TypeAlias = Annotated[
|
||||||
|
Union[ProviderAuthError, UnknownError, ErrorMessageOutputLengthError], PropertyInfo(discriminator="name")
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class AssistantMessage(BaseModel):
|
||||||
|
id: str
|
||||||
|
|
||||||
|
cost: float
|
||||||
|
|
||||||
|
api_model_id: str = FieldInfo(alias="modelID")
|
||||||
|
|
||||||
|
parts: List[AssistantMessagePart]
|
||||||
|
|
||||||
|
path: Path
|
||||||
|
|
||||||
|
provider_id: str = FieldInfo(alias="providerID")
|
||||||
|
|
||||||
|
role: Literal["assistant"]
|
||||||
|
|
||||||
|
session_id: str = FieldInfo(alias="sessionID")
|
||||||
|
|
||||||
|
system: List[str]
|
||||||
|
|
||||||
|
time: Time
|
||||||
|
|
||||||
|
tokens: Tokens
|
||||||
|
|
||||||
|
error: Optional[Error] = None
|
||||||
|
|
||||||
|
summary: Optional[bool] = None
|
||||||
15
src/opencode_ai/types/assistant_message_part.py
Normal file
15
src/opencode_ai/types/assistant_message_part.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from typing import Union
|
||||||
|
from typing_extensions import Annotated, TypeAlias
|
||||||
|
|
||||||
|
from .._utils import PropertyInfo
|
||||||
|
from .text_part import TextPart
|
||||||
|
from .tool_part import ToolPart
|
||||||
|
from .step_start_part import StepStartPart
|
||||||
|
|
||||||
|
__all__ = ["AssistantMessagePart"]
|
||||||
|
|
||||||
|
AssistantMessagePart: TypeAlias = Annotated[
|
||||||
|
Union[TextPart, ToolPart, StepStartPart], PropertyInfo(discriminator="type")
|
||||||
|
]
|
||||||
|
|
@ -9,8 +9,8 @@ from .._utils import PropertyInfo
|
||||||
from .message import Message
|
from .message import Message
|
||||||
from .session import Session
|
from .session import Session
|
||||||
from .._models import BaseModel
|
from .._models import BaseModel
|
||||||
from .message_part import MessagePart
|
|
||||||
from .shared.unknown_error import UnknownError
|
from .shared.unknown_error import UnknownError
|
||||||
|
from .assistant_message_part import AssistantMessagePart
|
||||||
from .shared.provider_auth_error import ProviderAuthError
|
from .shared.provider_auth_error import ProviderAuthError
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
@ -22,10 +22,10 @@ __all__ = [
|
||||||
"EventPermissionUpdatedPropertiesTime",
|
"EventPermissionUpdatedPropertiesTime",
|
||||||
"EventFileEdited",
|
"EventFileEdited",
|
||||||
"EventFileEditedProperties",
|
"EventFileEditedProperties",
|
||||||
"EventStorageWrite",
|
|
||||||
"EventStorageWriteProperties",
|
|
||||||
"EventInstallationUpdated",
|
"EventInstallationUpdated",
|
||||||
"EventInstallationUpdatedProperties",
|
"EventInstallationUpdatedProperties",
|
||||||
|
"EventStorageWrite",
|
||||||
|
"EventStorageWriteProperties",
|
||||||
"EventMessageUpdated",
|
"EventMessageUpdated",
|
||||||
"EventMessageUpdatedProperties",
|
"EventMessageUpdatedProperties",
|
||||||
"EventMessageRemoved",
|
"EventMessageRemoved",
|
||||||
|
|
@ -91,6 +91,16 @@ class EventFileEdited(BaseModel):
|
||||||
type: Literal["file.edited"]
|
type: Literal["file.edited"]
|
||||||
|
|
||||||
|
|
||||||
|
class EventInstallationUpdatedProperties(BaseModel):
|
||||||
|
version: str
|
||||||
|
|
||||||
|
|
||||||
|
class EventInstallationUpdated(BaseModel):
|
||||||
|
properties: EventInstallationUpdatedProperties
|
||||||
|
|
||||||
|
type: Literal["installation.updated"]
|
||||||
|
|
||||||
|
|
||||||
class EventStorageWriteProperties(BaseModel):
|
class EventStorageWriteProperties(BaseModel):
|
||||||
key: str
|
key: str
|
||||||
|
|
||||||
|
|
@ -103,16 +113,6 @@ class EventStorageWrite(BaseModel):
|
||||||
type: Literal["storage.write"]
|
type: Literal["storage.write"]
|
||||||
|
|
||||||
|
|
||||||
class EventInstallationUpdatedProperties(BaseModel):
|
|
||||||
version: str
|
|
||||||
|
|
||||||
|
|
||||||
class EventInstallationUpdated(BaseModel):
|
|
||||||
properties: EventInstallationUpdatedProperties
|
|
||||||
|
|
||||||
type: Literal["installation.updated"]
|
|
||||||
|
|
||||||
|
|
||||||
class EventMessageUpdatedProperties(BaseModel):
|
class EventMessageUpdatedProperties(BaseModel):
|
||||||
info: Message
|
info: Message
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ class EventMessageRemoved(BaseModel):
|
||||||
class EventMessagePartUpdatedProperties(BaseModel):
|
class EventMessagePartUpdatedProperties(BaseModel):
|
||||||
message_id: str = FieldInfo(alias="messageID")
|
message_id: str = FieldInfo(alias="messageID")
|
||||||
|
|
||||||
part: MessagePart
|
part: AssistantMessagePart
|
||||||
|
|
||||||
session_id: str = FieldInfo(alias="sessionID")
|
session_id: str = FieldInfo(alias="sessionID")
|
||||||
|
|
||||||
|
|
@ -218,8 +218,8 @@ EventListResponse: TypeAlias = Annotated[
|
||||||
EventLspClientDiagnostics,
|
EventLspClientDiagnostics,
|
||||||
EventPermissionUpdated,
|
EventPermissionUpdated,
|
||||||
EventFileEdited,
|
EventFileEdited,
|
||||||
EventStorageWrite,
|
|
||||||
EventInstallationUpdated,
|
EventInstallationUpdated,
|
||||||
|
EventStorageWrite,
|
||||||
EventMessageUpdated,
|
EventMessageUpdated,
|
||||||
EventMessageRemoved,
|
EventMessageRemoved,
|
||||||
EventMessagePartUpdated,
|
EventMessagePartUpdated,
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,13 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from pydantic import Field as FieldInfo
|
|
||||||
|
|
||||||
from .._models import BaseModel
|
from .._models import BaseModel
|
||||||
|
|
||||||
__all__ = ["FilePart"]
|
__all__ = ["FilePart"]
|
||||||
|
|
||||||
|
|
||||||
class FilePart(BaseModel):
|
class FilePart(BaseModel):
|
||||||
media_type: str = FieldInfo(alias="mediaType")
|
mime: str
|
||||||
|
|
||||||
type: Literal["file"]
|
type: Literal["file"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,13 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
from typing_extensions import Literal, Required, TypedDict
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
|
||||||
|
|
||||||
__all__ = ["FilePartParam"]
|
__all__ = ["FilePartParam"]
|
||||||
|
|
||||||
|
|
||||||
class FilePartParam(TypedDict, total=False):
|
class FilePartParam(TypedDict, total=False):
|
||||||
media_type: Required[Annotated[str, PropertyInfo(alias="mediaType")]]
|
mime: Required[str]
|
||||||
|
|
||||||
type: Required[Literal["file"]]
|
type: Required[Literal["file"]]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,125 +1,32 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Dict, List, Union, Optional
|
from typing import List, Union
|
||||||
from typing_extensions import Literal, Annotated, TypeAlias
|
from typing_extensions import Literal, Annotated, TypeAlias
|
||||||
|
|
||||||
from pydantic import Field as FieldInfo
|
from pydantic import Field as FieldInfo
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
from .._utils import PropertyInfo
|
||||||
from .._models import BaseModel
|
from .._models import BaseModel
|
||||||
from .message_part import MessagePart
|
from .assistant_message import AssistantMessage
|
||||||
from .shared.unknown_error import UnknownError
|
from .user_message_part import UserMessagePart
|
||||||
from .shared.provider_auth_error import ProviderAuthError
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = ["Message", "UserMessage", "UserMessageTime"]
|
||||||
"Message",
|
|
||||||
"Metadata",
|
|
||||||
"MetadataTime",
|
|
||||||
"MetadataTool",
|
|
||||||
"MetadataToolTime",
|
|
||||||
"MetadataAssistant",
|
|
||||||
"MetadataAssistantPath",
|
|
||||||
"MetadataAssistantTokens",
|
|
||||||
"MetadataAssistantTokensCache",
|
|
||||||
"MetadataError",
|
|
||||||
"MetadataErrorMessageOutputLengthError",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class MetadataTime(BaseModel):
|
class UserMessageTime(BaseModel):
|
||||||
created: float
|
created: float
|
||||||
|
|
||||||
completed: Optional[float] = None
|
|
||||||
|
|
||||||
|
class UserMessage(BaseModel):
|
||||||
class MetadataToolTime(BaseModel):
|
|
||||||
end: float
|
|
||||||
|
|
||||||
start: float
|
|
||||||
|
|
||||||
|
|
||||||
class MetadataTool(BaseModel):
|
|
||||||
time: MetadataToolTime
|
|
||||||
|
|
||||||
title: str
|
|
||||||
|
|
||||||
snapshot: Optional[str] = None
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
# Stub to indicate that arbitrary properties are accepted.
|
|
||||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
|
||||||
# `getattr(obj, '$type')`
|
|
||||||
def __getattr__(self, attr: str) -> object: ...
|
|
||||||
|
|
||||||
|
|
||||||
class MetadataAssistantPath(BaseModel):
|
|
||||||
cwd: str
|
|
||||||
|
|
||||||
root: str
|
|
||||||
|
|
||||||
|
|
||||||
class MetadataAssistantTokensCache(BaseModel):
|
|
||||||
read: float
|
|
||||||
|
|
||||||
write: float
|
|
||||||
|
|
||||||
|
|
||||||
class MetadataAssistantTokens(BaseModel):
|
|
||||||
cache: MetadataAssistantTokensCache
|
|
||||||
|
|
||||||
input: float
|
|
||||||
|
|
||||||
output: float
|
|
||||||
|
|
||||||
reasoning: float
|
|
||||||
|
|
||||||
|
|
||||||
class MetadataAssistant(BaseModel):
|
|
||||||
cost: float
|
|
||||||
|
|
||||||
api_model_id: str = FieldInfo(alias="modelID")
|
|
||||||
|
|
||||||
path: MetadataAssistantPath
|
|
||||||
|
|
||||||
provider_id: str = FieldInfo(alias="providerID")
|
|
||||||
|
|
||||||
system: List[str]
|
|
||||||
|
|
||||||
tokens: MetadataAssistantTokens
|
|
||||||
|
|
||||||
summary: Optional[bool] = None
|
|
||||||
|
|
||||||
|
|
||||||
class MetadataErrorMessageOutputLengthError(BaseModel):
|
|
||||||
data: object
|
|
||||||
|
|
||||||
name: Literal["MessageOutputLengthError"]
|
|
||||||
|
|
||||||
|
|
||||||
MetadataError: TypeAlias = Annotated[
|
|
||||||
Union[ProviderAuthError, UnknownError, MetadataErrorMessageOutputLengthError], PropertyInfo(discriminator="name")
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class Metadata(BaseModel):
|
|
||||||
session_id: str = FieldInfo(alias="sessionID")
|
|
||||||
|
|
||||||
time: MetadataTime
|
|
||||||
|
|
||||||
tool: Dict[str, MetadataTool]
|
|
||||||
|
|
||||||
assistant: Optional[MetadataAssistant] = None
|
|
||||||
|
|
||||||
error: Optional[MetadataError] = None
|
|
||||||
|
|
||||||
snapshot: Optional[str] = None
|
|
||||||
|
|
||||||
|
|
||||||
class Message(BaseModel):
|
|
||||||
id: str
|
id: str
|
||||||
|
|
||||||
metadata: Metadata
|
parts: List[UserMessagePart]
|
||||||
|
|
||||||
parts: List[MessagePart]
|
role: Literal["user"]
|
||||||
|
|
||||||
role: Literal["user", "assistant"]
|
session_id: str = FieldInfo(alias="sessionID")
|
||||||
|
|
||||||
|
time: UserMessageTime
|
||||||
|
|
||||||
|
|
||||||
|
Message: TypeAlias = Annotated[Union[UserMessage, AssistantMessage], PropertyInfo(discriminator="role")]
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from typing import Union
|
|
||||||
from typing_extensions import Annotated, TypeAlias
|
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
|
||||||
from .file_part import FilePart
|
|
||||||
from .text_part import TextPart
|
|
||||||
from .reasoning_part import ReasoningPart
|
|
||||||
from .source_url_part import SourceURLPart
|
|
||||||
from .step_start_part import StepStartPart
|
|
||||||
from .tool_invocation_part import ToolInvocationPart
|
|
||||||
|
|
||||||
__all__ = ["MessagePart"]
|
|
||||||
|
|
||||||
MessagePart: TypeAlias = Annotated[
|
|
||||||
Union[TextPart, ReasoningPart, ToolInvocationPart, SourceURLPart, FilePart, StepStartPart],
|
|
||||||
PropertyInfo(discriminator="type"),
|
|
||||||
]
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing import Union
|
|
||||||
from typing_extensions import TypeAlias
|
|
||||||
|
|
||||||
from .file_part_param import FilePartParam
|
|
||||||
from .text_part_param import TextPartParam
|
|
||||||
from .reasoning_part_param import ReasoningPartParam
|
|
||||||
from .source_url_part_param import SourceURLPartParam
|
|
||||||
from .step_start_part_param import StepStartPartParam
|
|
||||||
from .tool_invocation_part_param import ToolInvocationPartParam
|
|
||||||
|
|
||||||
__all__ = ["MessagePartParam"]
|
|
||||||
|
|
||||||
MessagePartParam: TypeAlias = Union[
|
|
||||||
TextPartParam, ReasoningPartParam, ToolInvocationPartParam, SourceURLPartParam, FilePartParam, StepStartPartParam
|
|
||||||
]
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from typing import Dict, Optional
|
|
||||||
from typing_extensions import Literal
|
|
||||||
|
|
||||||
from pydantic import Field as FieldInfo
|
|
||||||
|
|
||||||
from .._models import BaseModel
|
|
||||||
|
|
||||||
__all__ = ["ReasoningPart"]
|
|
||||||
|
|
||||||
|
|
||||||
class ReasoningPart(BaseModel):
|
|
||||||
text: str
|
|
||||||
|
|
||||||
type: Literal["reasoning"]
|
|
||||||
|
|
||||||
provider_metadata: Optional[Dict[str, object]] = FieldInfo(alias="providerMetadata", default=None)
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing import Dict
|
|
||||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
|
||||||
|
|
||||||
__all__ = ["ReasoningPartParam"]
|
|
||||||
|
|
||||||
|
|
||||||
class ReasoningPartParam(TypedDict, total=False):
|
|
||||||
text: Required[str]
|
|
||||||
|
|
||||||
type: Required[Literal["reasoning"]]
|
|
||||||
|
|
||||||
provider_metadata: Annotated[Dict[str, object], PropertyInfo(alias="providerMetadata")]
|
|
||||||
|
|
@ -6,7 +6,7 @@ from typing import Iterable
|
||||||
from typing_extensions import Required, Annotated, TypedDict
|
from typing_extensions import Required, Annotated, TypedDict
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
from .._utils import PropertyInfo
|
||||||
from .message_part_param import MessagePartParam
|
from .user_message_part_param import UserMessagePartParam
|
||||||
|
|
||||||
__all__ = ["SessionChatParams"]
|
__all__ = ["SessionChatParams"]
|
||||||
|
|
||||||
|
|
@ -14,6 +14,6 @@ __all__ = ["SessionChatParams"]
|
||||||
class SessionChatParams(TypedDict, total=False):
|
class SessionChatParams(TypedDict, total=False):
|
||||||
model_id: Required[Annotated[str, PropertyInfo(alias="modelID")]]
|
model_id: Required[Annotated[str, PropertyInfo(alias="modelID")]]
|
||||||
|
|
||||||
parts: Required[Iterable[MessagePartParam]]
|
parts: Required[Iterable[UserMessagePartParam]]
|
||||||
|
|
||||||
provider_id: Required[Annotated[str, PropertyInfo(alias="providerID")]]
|
provider_id: Required[Annotated[str, PropertyInfo(alias="providerID")]]
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from typing import Dict, Optional
|
|
||||||
from typing_extensions import Literal
|
|
||||||
|
|
||||||
from pydantic import Field as FieldInfo
|
|
||||||
|
|
||||||
from .._models import BaseModel
|
|
||||||
|
|
||||||
__all__ = ["SourceURLPart"]
|
|
||||||
|
|
||||||
|
|
||||||
class SourceURLPart(BaseModel):
|
|
||||||
source_id: str = FieldInfo(alias="sourceId")
|
|
||||||
|
|
||||||
type: Literal["source-url"]
|
|
||||||
|
|
||||||
url: str
|
|
||||||
|
|
||||||
provider_metadata: Optional[Dict[str, object]] = FieldInfo(alias="providerMetadata", default=None)
|
|
||||||
|
|
||||||
title: Optional[str] = None
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing import Dict
|
|
||||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
|
||||||
|
|
||||||
__all__ = ["SourceURLPartParam"]
|
|
||||||
|
|
||||||
|
|
||||||
class SourceURLPartParam(TypedDict, total=False):
|
|
||||||
source_id: Required[Annotated[str, PropertyInfo(alias="sourceId")]]
|
|
||||||
|
|
||||||
type: Required[Literal["source-url"]]
|
|
||||||
|
|
||||||
url: Required[str]
|
|
||||||
|
|
||||||
provider_metadata: Annotated[Dict[str, object], PropertyInfo(alias="providerMetadata")]
|
|
||||||
|
|
||||||
title: str
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing_extensions import Literal, Required, TypedDict
|
|
||||||
|
|
||||||
__all__ = ["StepStartPartParam"]
|
|
||||||
|
|
||||||
|
|
||||||
class StepStartPartParam(TypedDict, total=False):
|
|
||||||
type: Required[Literal["step-start"]]
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
from typing_extensions import Literal
|
|
||||||
|
|
||||||
from pydantic import Field as FieldInfo
|
|
||||||
|
|
||||||
from .._models import BaseModel
|
|
||||||
|
|
||||||
__all__ = ["ToolCall"]
|
|
||||||
|
|
||||||
|
|
||||||
class ToolCall(BaseModel):
|
|
||||||
state: Literal["call"]
|
|
||||||
|
|
||||||
tool_call_id: str = FieldInfo(alias="toolCallId")
|
|
||||||
|
|
||||||
tool_name: str = FieldInfo(alias="toolName")
|
|
||||||
|
|
||||||
args: Optional[object] = None
|
|
||||||
|
|
||||||
step: Optional[float] = None
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
|
||||||
|
|
||||||
__all__ = ["ToolCallParam"]
|
|
||||||
|
|
||||||
|
|
||||||
class ToolCallParam(TypedDict, total=False):
|
|
||||||
state: Required[Literal["call"]]
|
|
||||||
|
|
||||||
tool_call_id: Required[Annotated[str, PropertyInfo(alias="toolCallId")]]
|
|
||||||
|
|
||||||
tool_name: Required[Annotated[str, PropertyInfo(alias="toolName")]]
|
|
||||||
|
|
||||||
args: object
|
|
||||||
|
|
||||||
step: float
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from typing import Union
|
|
||||||
from typing_extensions import Literal, Annotated, TypeAlias
|
|
||||||
|
|
||||||
from pydantic import Field as FieldInfo
|
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
|
||||||
from .._models import BaseModel
|
|
||||||
from .tool_call import ToolCall
|
|
||||||
from .tool_result import ToolResult
|
|
||||||
from .tool_partial_call import ToolPartialCall
|
|
||||||
|
|
||||||
__all__ = ["ToolInvocationPart", "ToolInvocation"]
|
|
||||||
|
|
||||||
ToolInvocation: TypeAlias = Annotated[Union[ToolCall, ToolPartialCall, ToolResult], PropertyInfo(discriminator="state")]
|
|
||||||
|
|
||||||
|
|
||||||
class ToolInvocationPart(BaseModel):
|
|
||||||
tool_invocation: ToolInvocation = FieldInfo(alias="toolInvocation")
|
|
||||||
|
|
||||||
type: Literal["tool-invocation"]
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing import Union
|
|
||||||
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
|
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
|
||||||
from .tool_call_param import ToolCallParam
|
|
||||||
from .tool_result_param import ToolResultParam
|
|
||||||
from .tool_partial_call_param import ToolPartialCallParam
|
|
||||||
|
|
||||||
__all__ = ["ToolInvocationPartParam", "ToolInvocation"]
|
|
||||||
|
|
||||||
ToolInvocation: TypeAlias = Union[ToolCallParam, ToolPartialCallParam, ToolResultParam]
|
|
||||||
|
|
||||||
|
|
||||||
class ToolInvocationPartParam(TypedDict, total=False):
|
|
||||||
tool_invocation: Required[Annotated[ToolInvocation, PropertyInfo(alias="toolInvocation")]]
|
|
||||||
|
|
||||||
type: Required[Literal["tool-invocation"]]
|
|
||||||
27
src/opencode_ai/types/tool_part.py
Normal file
27
src/opencode_ai/types/tool_part.py
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from typing import Union
|
||||||
|
from typing_extensions import Literal, Annotated, TypeAlias
|
||||||
|
|
||||||
|
from .._utils import PropertyInfo
|
||||||
|
from .._models import BaseModel
|
||||||
|
from .tool_state_error import ToolStateError
|
||||||
|
from .tool_state_pending import ToolStatePending
|
||||||
|
from .tool_state_running import ToolStateRunning
|
||||||
|
from .tool_state_completed import ToolStateCompleted
|
||||||
|
|
||||||
|
__all__ = ["ToolPart", "State"]
|
||||||
|
|
||||||
|
State: TypeAlias = Annotated[
|
||||||
|
Union[ToolStatePending, ToolStateRunning, ToolStateCompleted, ToolStateError], PropertyInfo(discriminator="status")
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class ToolPart(BaseModel):
|
||||||
|
id: str
|
||||||
|
|
||||||
|
state: State
|
||||||
|
|
||||||
|
tool: str
|
||||||
|
|
||||||
|
type: Literal["tool"]
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
from typing_extensions import Literal
|
|
||||||
|
|
||||||
from pydantic import Field as FieldInfo
|
|
||||||
|
|
||||||
from .._models import BaseModel
|
|
||||||
|
|
||||||
__all__ = ["ToolPartialCall"]
|
|
||||||
|
|
||||||
|
|
||||||
class ToolPartialCall(BaseModel):
|
|
||||||
state: Literal["partial-call"]
|
|
||||||
|
|
||||||
tool_call_id: str = FieldInfo(alias="toolCallId")
|
|
||||||
|
|
||||||
tool_name: str = FieldInfo(alias="toolName")
|
|
||||||
|
|
||||||
args: Optional[object] = None
|
|
||||||
|
|
||||||
step: Optional[float] = None
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
|
||||||
|
|
||||||
__all__ = ["ToolPartialCallParam"]
|
|
||||||
|
|
||||||
|
|
||||||
class ToolPartialCallParam(TypedDict, total=False):
|
|
||||||
state: Required[Literal["partial-call"]]
|
|
||||||
|
|
||||||
tool_call_id: Required[Annotated[str, PropertyInfo(alias="toolCallId")]]
|
|
||||||
|
|
||||||
tool_name: Required[Annotated[str, PropertyInfo(alias="toolName")]]
|
|
||||||
|
|
||||||
args: object
|
|
||||||
|
|
||||||
step: float
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
from typing_extensions import Literal
|
|
||||||
|
|
||||||
from pydantic import Field as FieldInfo
|
|
||||||
|
|
||||||
from .._models import BaseModel
|
|
||||||
|
|
||||||
__all__ = ["ToolResult"]
|
|
||||||
|
|
||||||
|
|
||||||
class ToolResult(BaseModel):
|
|
||||||
result: str
|
|
||||||
|
|
||||||
state: Literal["result"]
|
|
||||||
|
|
||||||
tool_call_id: str = FieldInfo(alias="toolCallId")
|
|
||||||
|
|
||||||
tool_name: str = FieldInfo(alias="toolName")
|
|
||||||
|
|
||||||
args: Optional[object] = None
|
|
||||||
|
|
||||||
step: Optional[float] = None
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
|
||||||
|
|
||||||
from .._utils import PropertyInfo
|
|
||||||
|
|
||||||
__all__ = ["ToolResultParam"]
|
|
||||||
|
|
||||||
|
|
||||||
class ToolResultParam(TypedDict, total=False):
|
|
||||||
result: Required[str]
|
|
||||||
|
|
||||||
state: Required[Literal["result"]]
|
|
||||||
|
|
||||||
tool_call_id: Required[Annotated[str, PropertyInfo(alias="toolCallId")]]
|
|
||||||
|
|
||||||
tool_name: Required[Annotated[str, PropertyInfo(alias="toolName")]]
|
|
||||||
|
|
||||||
args: object
|
|
||||||
|
|
||||||
step: float
|
|
||||||
28
src/opencode_ai/types/tool_state_completed.py
Normal file
28
src/opencode_ai/types/tool_state_completed.py
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from typing import Dict, Optional
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
|
from .._models import BaseModel
|
||||||
|
|
||||||
|
__all__ = ["ToolStateCompleted", "Time"]
|
||||||
|
|
||||||
|
|
||||||
|
class Time(BaseModel):
|
||||||
|
end: float
|
||||||
|
|
||||||
|
start: float
|
||||||
|
|
||||||
|
|
||||||
|
class ToolStateCompleted(BaseModel):
|
||||||
|
metadata: Dict[str, object]
|
||||||
|
|
||||||
|
output: str
|
||||||
|
|
||||||
|
status: Literal["completed"]
|
||||||
|
|
||||||
|
time: Time
|
||||||
|
|
||||||
|
title: str
|
||||||
|
|
||||||
|
input: Optional[object] = None
|
||||||
24
src/opencode_ai/types/tool_state_error.py
Normal file
24
src/opencode_ai/types/tool_state_error.py
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from typing import Optional
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
|
from .._models import BaseModel
|
||||||
|
|
||||||
|
__all__ = ["ToolStateError", "Time"]
|
||||||
|
|
||||||
|
|
||||||
|
class Time(BaseModel):
|
||||||
|
end: float
|
||||||
|
|
||||||
|
start: float
|
||||||
|
|
||||||
|
|
||||||
|
class ToolStateError(BaseModel):
|
||||||
|
error: str
|
||||||
|
|
||||||
|
status: Literal["error"]
|
||||||
|
|
||||||
|
time: Time
|
||||||
|
|
||||||
|
input: Optional[object] = None
|
||||||
11
src/opencode_ai/types/tool_state_pending.py
Normal file
11
src/opencode_ai/types/tool_state_pending.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
|
from .._models import BaseModel
|
||||||
|
|
||||||
|
__all__ = ["ToolStatePending"]
|
||||||
|
|
||||||
|
|
||||||
|
class ToolStatePending(BaseModel):
|
||||||
|
status: Literal["pending"]
|
||||||
24
src/opencode_ai/types/tool_state_running.py
Normal file
24
src/opencode_ai/types/tool_state_running.py
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from typing import Dict, Optional
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
|
from .._models import BaseModel
|
||||||
|
|
||||||
|
__all__ = ["ToolStateRunning", "Time"]
|
||||||
|
|
||||||
|
|
||||||
|
class Time(BaseModel):
|
||||||
|
start: float
|
||||||
|
|
||||||
|
|
||||||
|
class ToolStateRunning(BaseModel):
|
||||||
|
status: Literal["running"]
|
||||||
|
|
||||||
|
time: Time
|
||||||
|
|
||||||
|
input: Optional[object] = None
|
||||||
|
|
||||||
|
metadata: Optional[Dict[str, object]] = None
|
||||||
|
|
||||||
|
title: Optional[str] = None
|
||||||
12
src/opencode_ai/types/user_message_part.py
Normal file
12
src/opencode_ai/types/user_message_part.py
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from typing import Union
|
||||||
|
from typing_extensions import Annotated, TypeAlias
|
||||||
|
|
||||||
|
from .._utils import PropertyInfo
|
||||||
|
from .file_part import FilePart
|
||||||
|
from .text_part import TextPart
|
||||||
|
|
||||||
|
__all__ = ["UserMessagePart"]
|
||||||
|
|
||||||
|
UserMessagePart: TypeAlias = Annotated[Union[TextPart, FilePart], PropertyInfo(discriminator="type")]
|
||||||
13
src/opencode_ai/types/user_message_part_param.py
Normal file
13
src/opencode_ai/types/user_message_part_param.py
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Union
|
||||||
|
from typing_extensions import TypeAlias
|
||||||
|
|
||||||
|
from .file_part_param import FilePartParam
|
||||||
|
from .text_part_param import TextPartParam
|
||||||
|
|
||||||
|
__all__ = ["UserMessagePartParam"]
|
||||||
|
|
||||||
|
UserMessagePartParam: TypeAlias = Union[TextPartParam, FilePartParam]
|
||||||
|
|
@ -10,8 +10,8 @@ import pytest
|
||||||
from opencode_ai import Opencode, AsyncOpencode
|
from opencode_ai import Opencode, AsyncOpencode
|
||||||
from tests.utils import assert_matches_type
|
from tests.utils import assert_matches_type
|
||||||
from opencode_ai.types import (
|
from opencode_ai.types import (
|
||||||
Message,
|
|
||||||
Session,
|
Session,
|
||||||
|
AssistantMessage,
|
||||||
SessionInitResponse,
|
SessionInitResponse,
|
||||||
SessionListResponse,
|
SessionListResponse,
|
||||||
SessionAbortResponse,
|
SessionAbortResponse,
|
||||||
|
|
@ -180,7 +180,7 @@ class TestSession:
|
||||||
],
|
],
|
||||||
provider_id="providerID",
|
provider_id="providerID",
|
||||||
)
|
)
|
||||||
assert_matches_type(Message, session, path=["response"])
|
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||||
|
|
||||||
@pytest.mark.skip()
|
@pytest.mark.skip()
|
||||||
@parametrize
|
@parametrize
|
||||||
|
|
@ -200,7 +200,7 @@ class TestSession:
|
||||||
assert response.is_closed is True
|
assert response.is_closed is True
|
||||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||||
session = response.parse()
|
session = response.parse()
|
||||||
assert_matches_type(Message, session, path=["response"])
|
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||||
|
|
||||||
@pytest.mark.skip()
|
@pytest.mark.skip()
|
||||||
@parametrize
|
@parametrize
|
||||||
|
|
@ -220,7 +220,7 @@ class TestSession:
|
||||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||||
|
|
||||||
session = response.parse()
|
session = response.parse()
|
||||||
assert_matches_type(Message, session, path=["response"])
|
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||||
|
|
||||||
assert cast(Any, response.is_closed) is True
|
assert cast(Any, response.is_closed) is True
|
||||||
|
|
||||||
|
|
@ -626,7 +626,7 @@ class TestAsyncSession:
|
||||||
],
|
],
|
||||||
provider_id="providerID",
|
provider_id="providerID",
|
||||||
)
|
)
|
||||||
assert_matches_type(Message, session, path=["response"])
|
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||||
|
|
||||||
@pytest.mark.skip()
|
@pytest.mark.skip()
|
||||||
@parametrize
|
@parametrize
|
||||||
|
|
@ -646,7 +646,7 @@ class TestAsyncSession:
|
||||||
assert response.is_closed is True
|
assert response.is_closed is True
|
||||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||||
session = await response.parse()
|
session = await response.parse()
|
||||||
assert_matches_type(Message, session, path=["response"])
|
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||||
|
|
||||||
@pytest.mark.skip()
|
@pytest.mark.skip()
|
||||||
@parametrize
|
@parametrize
|
||||||
|
|
@ -666,7 +666,7 @@ class TestAsyncSession:
|
||||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||||
|
|
||||||
session = await response.parse()
|
session = await response.parse()
|
||||||
assert_matches_type(Message, session, path=["response"])
|
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||||
|
|
||||||
assert cast(Any, response.is_closed) is True
|
assert cast(Any, response.is_closed) is True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue