mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-04-28 20:50:07 +00:00
feat(api): manual updates
This commit is contained in:
parent
d4ab769b98
commit
64c9b57dda
34 changed files with 305 additions and 477 deletions
|
|
@ -18,13 +18,13 @@ from .._response import (
|
|||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from .._base_client import make_request_options
|
||||
from ..types.message import Message
|
||||
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_list_response import SessionListResponse
|
||||
from ..types.session_abort_response import SessionAbortResponse
|
||||
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_summarize_response import SessionSummarizeResponse
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ class SessionResource(SyncAPIResource):
|
|||
id: str,
|
||||
*,
|
||||
model_id: str,
|
||||
parts: Iterable[MessagePartParam],
|
||||
parts: Iterable[UserMessagePartParam],
|
||||
provider_id: str,
|
||||
# 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.
|
||||
|
|
@ -168,7 +168,7 @@ class SessionResource(SyncAPIResource):
|
|||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> Message:
|
||||
) -> AssistantMessage:
|
||||
"""
|
||||
Create and send a new message to a session
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ class SessionResource(SyncAPIResource):
|
|||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=Message,
|
||||
cast_to=AssistantMessage,
|
||||
)
|
||||
|
||||
def init(
|
||||
|
|
@ -520,7 +520,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
id: str,
|
||||
*,
|
||||
model_id: str,
|
||||
parts: Iterable[MessagePartParam],
|
||||
parts: Iterable[UserMessagePartParam],
|
||||
provider_id: str,
|
||||
# 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.
|
||||
|
|
@ -528,7 +528,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> Message:
|
||||
) -> AssistantMessage:
|
||||
"""
|
||||
Create and send a new message to a session
|
||||
|
||||
|
|
@ -558,7 +558,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=Message,
|
||||
cast_to=AssistantMessage,
|
||||
)
|
||||
|
||||
async def init(
|
||||
|
|
|
|||
|
|
@ -13,43 +13,37 @@ from .provider import Provider as Provider
|
|||
from .file_part import FilePart as FilePart
|
||||
from .mcp_local import McpLocal as McpLocal
|
||||
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 .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 .source_url_part import SourceURLPart as SourceURLPart
|
||||
from .step_start_part import StepStartPart as StepStartPart
|
||||
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 .find_text_params import FindTextParams as FindTextParams
|
||||
from .tool_state_error import ToolStateError as ToolStateError
|
||||
from .app_init_response import AppInitResponse as AppInitResponse
|
||||
from .assistant_message import AssistantMessage as AssistantMessage
|
||||
from .find_files_params import FindFilesParams as FindFilesParams
|
||||
from .tool_partial_call import ToolPartialCall as ToolPartialCall
|
||||
from .tool_result_param import ToolResultParam as ToolResultParam
|
||||
from .user_message_part import UserMessagePart as UserMessagePart
|
||||
from .file_read_response import FileReadResponse as FileReadResponse
|
||||
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 .find_files_response import FindFilesResponse as FindFilesResponse
|
||||
from .find_symbols_params import FindSymbolsParams as FindSymbolsParams
|
||||
from .session_chat_params import SessionChatParams as SessionChatParams
|
||||
from .session_init_params import SessionInitParams as SessionInitParams
|
||||
from .file_status_response import FileStatusResponse as FileStatusResponse
|
||||
from .reasoning_part_param import ReasoningPartParam as ReasoningPartParam
|
||||
from .tool_invocation_part import ToolInvocationPart as ToolInvocationPart
|
||||
from .tool_state_completed import ToolStateCompleted as ToolStateCompleted
|
||||
from .find_symbols_response import FindSymbolsResponse as FindSymbolsResponse
|
||||
from .session_init_response import SessionInitResponse as SessionInitResponse
|
||||
from .session_list_response import SessionListResponse as SessionListResponse
|
||||
from .source_url_part_param import SourceURLPartParam as SourceURLPartParam
|
||||
from .step_start_part_param import StepStartPartParam as StepStartPartParam
|
||||
from .assistant_message_part import AssistantMessagePart as AssistantMessagePart
|
||||
from .session_abort_response import SessionAbortResponse as SessionAbortResponse
|
||||
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 .config_providers_response import ConfigProvidersResponse as ConfigProvidersResponse
|
||||
from .session_messages_response import SessionMessagesResponse as SessionMessagesResponse
|
||||
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 .session import Session
|
||||
from .._models import BaseModel
|
||||
from .message_part import MessagePart
|
||||
from .shared.unknown_error import UnknownError
|
||||
from .assistant_message_part import AssistantMessagePart
|
||||
from .shared.provider_auth_error import ProviderAuthError
|
||||
|
||||
__all__ = [
|
||||
|
|
@ -22,10 +22,10 @@ __all__ = [
|
|||
"EventPermissionUpdatedPropertiesTime",
|
||||
"EventFileEdited",
|
||||
"EventFileEditedProperties",
|
||||
"EventStorageWrite",
|
||||
"EventStorageWriteProperties",
|
||||
"EventInstallationUpdated",
|
||||
"EventInstallationUpdatedProperties",
|
||||
"EventStorageWrite",
|
||||
"EventStorageWriteProperties",
|
||||
"EventMessageUpdated",
|
||||
"EventMessageUpdatedProperties",
|
||||
"EventMessageRemoved",
|
||||
|
|
@ -91,6 +91,16 @@ class EventFileEdited(BaseModel):
|
|||
type: Literal["file.edited"]
|
||||
|
||||
|
||||
class EventInstallationUpdatedProperties(BaseModel):
|
||||
version: str
|
||||
|
||||
|
||||
class EventInstallationUpdated(BaseModel):
|
||||
properties: EventInstallationUpdatedProperties
|
||||
|
||||
type: Literal["installation.updated"]
|
||||
|
||||
|
||||
class EventStorageWriteProperties(BaseModel):
|
||||
key: str
|
||||
|
||||
|
|
@ -103,16 +113,6 @@ class EventStorageWrite(BaseModel):
|
|||
type: Literal["storage.write"]
|
||||
|
||||
|
||||
class EventInstallationUpdatedProperties(BaseModel):
|
||||
version: str
|
||||
|
||||
|
||||
class EventInstallationUpdated(BaseModel):
|
||||
properties: EventInstallationUpdatedProperties
|
||||
|
||||
type: Literal["installation.updated"]
|
||||
|
||||
|
||||
class EventMessageUpdatedProperties(BaseModel):
|
||||
info: Message
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ class EventMessageRemoved(BaseModel):
|
|||
class EventMessagePartUpdatedProperties(BaseModel):
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
part: MessagePart
|
||||
part: AssistantMessagePart
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
|
|
@ -218,8 +218,8 @@ EventListResponse: TypeAlias = Annotated[
|
|||
EventLspClientDiagnostics,
|
||||
EventPermissionUpdated,
|
||||
EventFileEdited,
|
||||
EventStorageWrite,
|
||||
EventInstallationUpdated,
|
||||
EventStorageWrite,
|
||||
EventMessageUpdated,
|
||||
EventMessageRemoved,
|
||||
EventMessagePartUpdated,
|
||||
|
|
|
|||
|
|
@ -3,15 +3,13 @@
|
|||
from typing import Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["FilePart"]
|
||||
|
||||
|
||||
class FilePart(BaseModel):
|
||||
media_type: str = FieldInfo(alias="mediaType")
|
||||
mime: str
|
||||
|
||||
type: Literal["file"]
|
||||
|
||||
|
|
|
|||
|
|
@ -2,15 +2,13 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
__all__ = ["FilePartParam"]
|
||||
|
||||
|
||||
class FilePartParam(TypedDict, total=False):
|
||||
media_type: Required[Annotated[str, PropertyInfo(alias="mediaType")]]
|
||||
mime: Required[str]
|
||||
|
||||
type: Required[Literal["file"]]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,125 +1,32 @@
|
|||
# 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 pydantic import Field as FieldInfo
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .message_part import MessagePart
|
||||
from .shared.unknown_error import UnknownError
|
||||
from .shared.provider_auth_error import ProviderAuthError
|
||||
from .assistant_message import AssistantMessage
|
||||
from .user_message_part import UserMessagePart
|
||||
|
||||
__all__ = [
|
||||
"Message",
|
||||
"Metadata",
|
||||
"MetadataTime",
|
||||
"MetadataTool",
|
||||
"MetadataToolTime",
|
||||
"MetadataAssistant",
|
||||
"MetadataAssistantPath",
|
||||
"MetadataAssistantTokens",
|
||||
"MetadataAssistantTokensCache",
|
||||
"MetadataError",
|
||||
"MetadataErrorMessageOutputLengthError",
|
||||
]
|
||||
__all__ = ["Message", "UserMessage", "UserMessageTime"]
|
||||
|
||||
|
||||
class MetadataTime(BaseModel):
|
||||
class UserMessageTime(BaseModel):
|
||||
created: float
|
||||
|
||||
completed: Optional[float] = None
|
||||
|
||||
|
||||
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):
|
||||
class UserMessage(BaseModel):
|
||||
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 .._utils import PropertyInfo
|
||||
from .message_part_param import MessagePartParam
|
||||
from .user_message_part_param import UserMessagePartParam
|
||||
|
||||
__all__ = ["SessionChatParams"]
|
||||
|
||||
|
|
@ -14,6 +14,6 @@ __all__ = ["SessionChatParams"]
|
|||
class SessionChatParams(TypedDict, total=False):
|
||||
model_id: Required[Annotated[str, PropertyInfo(alias="modelID")]]
|
||||
|
||||
parts: Required[Iterable[MessagePartParam]]
|
||||
parts: Required[Iterable[UserMessagePartParam]]
|
||||
|
||||
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]
|
||||
Loading…
Add table
Add a link
Reference in a new issue