agentex-sdk 0.1.0a6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agentex/__init__.py +103 -0
- agentex/_base_client.py +1992 -0
- agentex/_client.py +506 -0
- agentex/_compat.py +219 -0
- agentex/_constants.py +14 -0
- agentex/_exceptions.py +108 -0
- agentex/_files.py +123 -0
- agentex/_models.py +829 -0
- agentex/_qs.py +150 -0
- agentex/_resource.py +43 -0
- agentex/_response.py +830 -0
- agentex/_streaming.py +333 -0
- agentex/_types.py +219 -0
- agentex/_utils/__init__.py +57 -0
- agentex/_utils/_logs.py +25 -0
- agentex/_utils/_proxy.py +65 -0
- agentex/_utils/_reflection.py +42 -0
- agentex/_utils/_resources_proxy.py +24 -0
- agentex/_utils/_streams.py +12 -0
- agentex/_utils/_sync.py +86 -0
- agentex/_utils/_transform.py +447 -0
- agentex/_utils/_typing.py +151 -0
- agentex/_utils/_utils.py +422 -0
- agentex/_version.py +4 -0
- agentex/lib/.keep +4 -0
- agentex/lib/__init__.py +0 -0
- agentex/lib/adk/__init__.py +41 -0
- agentex/lib/adk/_modules/__init__.py +0 -0
- agentex/lib/adk/_modules/acp.py +247 -0
- agentex/lib/adk/_modules/agent_task_tracker.py +176 -0
- agentex/lib/adk/_modules/agents.py +77 -0
- agentex/lib/adk/_modules/events.py +141 -0
- agentex/lib/adk/_modules/messages.py +285 -0
- agentex/lib/adk/_modules/state.py +291 -0
- agentex/lib/adk/_modules/streaming.py +75 -0
- agentex/lib/adk/_modules/tasks.py +124 -0
- agentex/lib/adk/_modules/tracing.py +194 -0
- agentex/lib/adk/providers/__init__.py +9 -0
- agentex/lib/adk/providers/_modules/__init__.py +0 -0
- agentex/lib/adk/providers/_modules/litellm.py +232 -0
- agentex/lib/adk/providers/_modules/openai.py +416 -0
- agentex/lib/adk/providers/_modules/sgp.py +85 -0
- agentex/lib/adk/utils/__init__.py +5 -0
- agentex/lib/adk/utils/_modules/__init__.py +0 -0
- agentex/lib/adk/utils/_modules/templating.py +94 -0
- agentex/lib/cli/__init__.py +0 -0
- agentex/lib/cli/commands/__init__.py +0 -0
- agentex/lib/cli/commands/agents.py +328 -0
- agentex/lib/cli/commands/init.py +227 -0
- agentex/lib/cli/commands/main.py +33 -0
- agentex/lib/cli/commands/secrets.py +169 -0
- agentex/lib/cli/commands/tasks.py +118 -0
- agentex/lib/cli/commands/uv.py +133 -0
- agentex/lib/cli/handlers/__init__.py +0 -0
- agentex/lib/cli/handlers/agent_handlers.py +160 -0
- agentex/lib/cli/handlers/cleanup_handlers.py +186 -0
- agentex/lib/cli/handlers/deploy_handlers.py +351 -0
- agentex/lib/cli/handlers/run_handlers.py +452 -0
- agentex/lib/cli/handlers/secret_handlers.py +670 -0
- agentex/lib/cli/templates/default/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/default/Dockerfile-uv.j2 +42 -0
- agentex/lib/cli/templates/default/Dockerfile.j2 +42 -0
- agentex/lib/cli/templates/default/README.md.j2 +193 -0
- agentex/lib/cli/templates/default/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/default/manifest.yaml.j2 +116 -0
- agentex/lib/cli/templates/default/project/acp.py.j2 +29 -0
- agentex/lib/cli/templates/default/pyproject.toml.j2 +33 -0
- agentex/lib/cli/templates/default/requirements.txt.j2 +5 -0
- agentex/lib/cli/templates/deploy/Screenshot 2025-03-19 at 10.36.57/342/200/257AM.png +0 -0
- agentex/lib/cli/templates/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/sync/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/sync/Dockerfile-uv.j2 +42 -0
- agentex/lib/cli/templates/sync/Dockerfile.j2 +42 -0
- agentex/lib/cli/templates/sync/README.md.j2 +293 -0
- agentex/lib/cli/templates/sync/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/sync/manifest.yaml.j2 +116 -0
- agentex/lib/cli/templates/sync/project/acp.py.j2 +26 -0
- agentex/lib/cli/templates/sync/pyproject.toml.j2 +33 -0
- agentex/lib/cli/templates/sync/requirements.txt.j2 +5 -0
- agentex/lib/cli/templates/temporal/.dockerignore.j2 +43 -0
- agentex/lib/cli/templates/temporal/Dockerfile-uv.j2 +48 -0
- agentex/lib/cli/templates/temporal/Dockerfile.j2 +48 -0
- agentex/lib/cli/templates/temporal/README.md.j2 +316 -0
- agentex/lib/cli/templates/temporal/deploy/example.yaml.j2 +55 -0
- agentex/lib/cli/templates/temporal/manifest.yaml.j2 +137 -0
- agentex/lib/cli/templates/temporal/project/acp.py.j2 +30 -0
- agentex/lib/cli/templates/temporal/project/run_worker.py.j2 +33 -0
- agentex/lib/cli/templates/temporal/project/workflow.py.j2 +66 -0
- agentex/lib/cli/templates/temporal/pyproject.toml.j2 +34 -0
- agentex/lib/cli/templates/temporal/requirements.txt.j2 +5 -0
- agentex/lib/cli/utils/cli_utils.py +14 -0
- agentex/lib/cli/utils/credential_utils.py +103 -0
- agentex/lib/cli/utils/exceptions.py +6 -0
- agentex/lib/cli/utils/kubectl_utils.py +135 -0
- agentex/lib/cli/utils/kubernetes_secrets_utils.py +185 -0
- agentex/lib/core/__init__.py +0 -0
- agentex/lib/core/adapters/__init__.py +0 -0
- agentex/lib/core/adapters/llm/__init__.py +1 -0
- agentex/lib/core/adapters/llm/adapter_litellm.py +46 -0
- agentex/lib/core/adapters/llm/adapter_sgp.py +55 -0
- agentex/lib/core/adapters/llm/port.py +24 -0
- agentex/lib/core/adapters/streams/adapter_redis.py +128 -0
- agentex/lib/core/adapters/streams/port.py +50 -0
- agentex/lib/core/clients/__init__.py +1 -0
- agentex/lib/core/clients/temporal/__init__.py +0 -0
- agentex/lib/core/clients/temporal/temporal_client.py +181 -0
- agentex/lib/core/clients/temporal/types.py +47 -0
- agentex/lib/core/clients/temporal/utils.py +56 -0
- agentex/lib/core/services/__init__.py +0 -0
- agentex/lib/core/services/adk/__init__.py +0 -0
- agentex/lib/core/services/adk/acp/__init__.py +0 -0
- agentex/lib/core/services/adk/acp/acp.py +210 -0
- agentex/lib/core/services/adk/agent_task_tracker.py +85 -0
- agentex/lib/core/services/adk/agents.py +43 -0
- agentex/lib/core/services/adk/events.py +61 -0
- agentex/lib/core/services/adk/messages.py +164 -0
- agentex/lib/core/services/adk/providers/__init__.py +0 -0
- agentex/lib/core/services/adk/providers/litellm.py +256 -0
- agentex/lib/core/services/adk/providers/openai.py +723 -0
- agentex/lib/core/services/adk/providers/sgp.py +99 -0
- agentex/lib/core/services/adk/state.py +120 -0
- agentex/lib/core/services/adk/streaming.py +262 -0
- agentex/lib/core/services/adk/tasks.py +69 -0
- agentex/lib/core/services/adk/tracing.py +36 -0
- agentex/lib/core/services/adk/utils/__init__.py +0 -0
- agentex/lib/core/services/adk/utils/templating.py +58 -0
- agentex/lib/core/temporal/__init__.py +0 -0
- agentex/lib/core/temporal/activities/__init__.py +207 -0
- agentex/lib/core/temporal/activities/activity_helpers.py +37 -0
- agentex/lib/core/temporal/activities/adk/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/acp/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/acp/acp_activities.py +86 -0
- agentex/lib/core/temporal/activities/adk/agent_task_tracker_activities.py +76 -0
- agentex/lib/core/temporal/activities/adk/agents_activities.py +35 -0
- agentex/lib/core/temporal/activities/adk/events_activities.py +50 -0
- agentex/lib/core/temporal/activities/adk/messages_activities.py +94 -0
- agentex/lib/core/temporal/activities/adk/providers/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/providers/litellm_activities.py +71 -0
- agentex/lib/core/temporal/activities/adk/providers/openai_activities.py +210 -0
- agentex/lib/core/temporal/activities/adk/providers/sgp_activities.py +42 -0
- agentex/lib/core/temporal/activities/adk/state_activities.py +85 -0
- agentex/lib/core/temporal/activities/adk/streaming_activities.py +33 -0
- agentex/lib/core/temporal/activities/adk/tasks_activities.py +48 -0
- agentex/lib/core/temporal/activities/adk/tracing_activities.py +55 -0
- agentex/lib/core/temporal/activities/adk/utils/__init__.py +0 -0
- agentex/lib/core/temporal/activities/adk/utils/templating_activities.py +41 -0
- agentex/lib/core/temporal/services/__init__.py +0 -0
- agentex/lib/core/temporal/services/temporal_task_service.py +69 -0
- agentex/lib/core/temporal/types/__init__.py +0 -0
- agentex/lib/core/temporal/types/workflow.py +5 -0
- agentex/lib/core/temporal/workers/__init__.py +0 -0
- agentex/lib/core/temporal/workers/worker.py +162 -0
- agentex/lib/core/temporal/workflows/workflow.py +26 -0
- agentex/lib/core/tracing/__init__.py +5 -0
- agentex/lib/core/tracing/processors/agentex_tracing_processor.py +117 -0
- agentex/lib/core/tracing/processors/sgp_tracing_processor.py +119 -0
- agentex/lib/core/tracing/processors/tracing_processor_interface.py +40 -0
- agentex/lib/core/tracing/trace.py +311 -0
- agentex/lib/core/tracing/tracer.py +70 -0
- agentex/lib/core/tracing/tracing_processor_manager.py +62 -0
- agentex/lib/environment_variables.py +87 -0
- agentex/lib/py.typed +0 -0
- agentex/lib/sdk/__init__.py +0 -0
- agentex/lib/sdk/config/__init__.py +0 -0
- agentex/lib/sdk/config/agent_config.py +61 -0
- agentex/lib/sdk/config/agent_manifest.py +219 -0
- agentex/lib/sdk/config/build_config.py +35 -0
- agentex/lib/sdk/config/deployment_config.py +117 -0
- agentex/lib/sdk/config/local_development_config.py +56 -0
- agentex/lib/sdk/config/project_config.py +103 -0
- agentex/lib/sdk/fastacp/__init__.py +3 -0
- agentex/lib/sdk/fastacp/base/base_acp_server.py +406 -0
- agentex/lib/sdk/fastacp/fastacp.py +74 -0
- agentex/lib/sdk/fastacp/impl/agentic_base_acp.py +72 -0
- agentex/lib/sdk/fastacp/impl/sync_acp.py +109 -0
- agentex/lib/sdk/fastacp/impl/temporal_acp.py +97 -0
- agentex/lib/sdk/fastacp/tests/README.md +297 -0
- agentex/lib/sdk/fastacp/tests/conftest.py +307 -0
- agentex/lib/sdk/fastacp/tests/pytest.ini +10 -0
- agentex/lib/sdk/fastacp/tests/run_tests.py +227 -0
- agentex/lib/sdk/fastacp/tests/test_base_acp_server.py +450 -0
- agentex/lib/sdk/fastacp/tests/test_fastacp_factory.py +344 -0
- agentex/lib/sdk/fastacp/tests/test_integration.py +477 -0
- agentex/lib/sdk/state_machine/__init__.py +6 -0
- agentex/lib/sdk/state_machine/noop_workflow.py +21 -0
- agentex/lib/sdk/state_machine/state.py +10 -0
- agentex/lib/sdk/state_machine/state_machine.py +189 -0
- agentex/lib/sdk/state_machine/state_workflow.py +16 -0
- agentex/lib/sdk/utils/__init__.py +0 -0
- agentex/lib/sdk/utils/messages.py +223 -0
- agentex/lib/types/__init__.py +0 -0
- agentex/lib/types/acp.py +94 -0
- agentex/lib/types/agent_configs.py +79 -0
- agentex/lib/types/agent_results.py +29 -0
- agentex/lib/types/credentials.py +34 -0
- agentex/lib/types/fastacp.py +61 -0
- agentex/lib/types/files.py +13 -0
- agentex/lib/types/json_rpc.py +49 -0
- agentex/lib/types/llm_messages.py +354 -0
- agentex/lib/types/task_message_updates.py +171 -0
- agentex/lib/types/tracing.py +34 -0
- agentex/lib/utils/__init__.py +0 -0
- agentex/lib/utils/completions.py +131 -0
- agentex/lib/utils/console.py +14 -0
- agentex/lib/utils/io.py +29 -0
- agentex/lib/utils/iterables.py +14 -0
- agentex/lib/utils/json_schema.py +23 -0
- agentex/lib/utils/logging.py +31 -0
- agentex/lib/utils/mcp.py +17 -0
- agentex/lib/utils/model_utils.py +46 -0
- agentex/lib/utils/parsing.py +15 -0
- agentex/lib/utils/regex.py +6 -0
- agentex/lib/utils/temporal.py +13 -0
- agentex/py.typed +0 -0
- agentex/resources/__init__.py +103 -0
- agentex/resources/agents.py +707 -0
- agentex/resources/events.py +294 -0
- agentex/resources/messages/__init__.py +33 -0
- agentex/resources/messages/batch.py +271 -0
- agentex/resources/messages/messages.py +492 -0
- agentex/resources/spans.py +557 -0
- agentex/resources/states.py +544 -0
- agentex/resources/tasks.py +615 -0
- agentex/resources/tracker.py +384 -0
- agentex/types/__init__.py +56 -0
- agentex/types/acp_type.py +7 -0
- agentex/types/agent.py +29 -0
- agentex/types/agent_list_params.py +13 -0
- agentex/types/agent_list_response.py +10 -0
- agentex/types/agent_rpc_by_name_params.py +21 -0
- agentex/types/agent_rpc_params.py +51 -0
- agentex/types/agent_rpc_params1.py +21 -0
- agentex/types/agent_rpc_response.py +20 -0
- agentex/types/agent_rpc_result.py +90 -0
- agentex/types/agent_task_tracker.py +34 -0
- agentex/types/data_content.py +30 -0
- agentex/types/data_content_param.py +31 -0
- agentex/types/data_delta.py +14 -0
- agentex/types/event.py +29 -0
- agentex/types/event_list_params.py +22 -0
- agentex/types/event_list_response.py +10 -0
- agentex/types/message_author.py +7 -0
- agentex/types/message_create_params.py +18 -0
- agentex/types/message_list_params.py +14 -0
- agentex/types/message_list_response.py +10 -0
- agentex/types/message_style.py +7 -0
- agentex/types/message_update_params.py +18 -0
- agentex/types/messages/__init__.py +8 -0
- agentex/types/messages/batch_create_params.py +16 -0
- agentex/types/messages/batch_create_response.py +10 -0
- agentex/types/messages/batch_update_params.py +16 -0
- agentex/types/messages/batch_update_response.py +10 -0
- agentex/types/shared/__init__.py +3 -0
- agentex/types/shared/task_message_update.py +83 -0
- agentex/types/span.py +36 -0
- agentex/types/span_create_params.py +40 -0
- agentex/types/span_list_params.py +12 -0
- agentex/types/span_list_response.py +10 -0
- agentex/types/span_update_params.py +37 -0
- agentex/types/state.py +25 -0
- agentex/types/state_create_params.py +16 -0
- agentex/types/state_list_params.py +16 -0
- agentex/types/state_list_response.py +10 -0
- agentex/types/state_update_params.py +16 -0
- agentex/types/task.py +23 -0
- agentex/types/task_delete_by_name_response.py +8 -0
- agentex/types/task_delete_response.py +8 -0
- agentex/types/task_list_response.py +10 -0
- agentex/types/task_message.py +33 -0
- agentex/types/task_message_content.py +16 -0
- agentex/types/task_message_content_param.py +17 -0
- agentex/types/task_message_delta.py +16 -0
- agentex/types/text_content.py +53 -0
- agentex/types/text_content_param.py +54 -0
- agentex/types/text_delta.py +14 -0
- agentex/types/tool_request_content.py +36 -0
- agentex/types/tool_request_content_param.py +37 -0
- agentex/types/tool_request_delta.py +18 -0
- agentex/types/tool_response_content.py +36 -0
- agentex/types/tool_response_content_param.py +36 -0
- agentex/types/tool_response_delta.py +18 -0
- agentex/types/tracker_list_params.py +16 -0
- agentex/types/tracker_list_response.py +10 -0
- agentex/types/tracker_update_params.py +19 -0
- agentex_sdk-0.1.0a6.dist-info/METADATA +426 -0
- agentex_sdk-0.1.0a6.dist-info/RECORD +289 -0
- agentex_sdk-0.1.0a6.dist-info/WHEEL +4 -0
- agentex_sdk-0.1.0a6.dist-info/entry_points.txt +2 -0
- agentex_sdk-0.1.0a6.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,492 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing import Optional
|
6
|
+
from typing_extensions import Literal
|
7
|
+
|
8
|
+
import httpx
|
9
|
+
|
10
|
+
from .batch import (
|
11
|
+
BatchResource,
|
12
|
+
AsyncBatchResource,
|
13
|
+
BatchResourceWithRawResponse,
|
14
|
+
AsyncBatchResourceWithRawResponse,
|
15
|
+
BatchResourceWithStreamingResponse,
|
16
|
+
AsyncBatchResourceWithStreamingResponse,
|
17
|
+
)
|
18
|
+
from ...types import message_list_params, message_create_params, message_update_params
|
19
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
20
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
21
|
+
from ..._compat import cached_property
|
22
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
23
|
+
from ..._response import (
|
24
|
+
to_raw_response_wrapper,
|
25
|
+
to_streamed_response_wrapper,
|
26
|
+
async_to_raw_response_wrapper,
|
27
|
+
async_to_streamed_response_wrapper,
|
28
|
+
)
|
29
|
+
from ..._base_client import make_request_options
|
30
|
+
from ...types.task_message import TaskMessage
|
31
|
+
from ...types.message_list_response import MessageListResponse
|
32
|
+
from ...types.task_message_content_param import TaskMessageContentParam
|
33
|
+
|
34
|
+
__all__ = ["MessagesResource", "AsyncMessagesResource"]
|
35
|
+
|
36
|
+
|
37
|
+
class MessagesResource(SyncAPIResource):
|
38
|
+
@cached_property
|
39
|
+
def batch(self) -> BatchResource:
|
40
|
+
return BatchResource(self._client)
|
41
|
+
|
42
|
+
@cached_property
|
43
|
+
def with_raw_response(self) -> MessagesResourceWithRawResponse:
|
44
|
+
"""
|
45
|
+
This property can be used as a prefix for any HTTP method call to return
|
46
|
+
the raw response object instead of the parsed content.
|
47
|
+
|
48
|
+
For more information, see https://www.github.com/scaleapi/agentex-python#accessing-raw-response-data-eg-headers
|
49
|
+
"""
|
50
|
+
return MessagesResourceWithRawResponse(self)
|
51
|
+
|
52
|
+
@cached_property
|
53
|
+
def with_streaming_response(self) -> MessagesResourceWithStreamingResponse:
|
54
|
+
"""
|
55
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
56
|
+
|
57
|
+
For more information, see https://www.github.com/scaleapi/agentex-python#with_streaming_response
|
58
|
+
"""
|
59
|
+
return MessagesResourceWithStreamingResponse(self)
|
60
|
+
|
61
|
+
def create(
|
62
|
+
self,
|
63
|
+
*,
|
64
|
+
content: TaskMessageContentParam,
|
65
|
+
task_id: str,
|
66
|
+
streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN,
|
67
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
68
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
69
|
+
extra_headers: Headers | None = None,
|
70
|
+
extra_query: Query | None = None,
|
71
|
+
extra_body: Body | None = None,
|
72
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
73
|
+
) -> TaskMessage:
|
74
|
+
"""
|
75
|
+
Create Message
|
76
|
+
|
77
|
+
Args:
|
78
|
+
extra_headers: Send extra headers
|
79
|
+
|
80
|
+
extra_query: Add additional query parameters to the request
|
81
|
+
|
82
|
+
extra_body: Add additional JSON properties to the request
|
83
|
+
|
84
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
85
|
+
"""
|
86
|
+
return self._post(
|
87
|
+
"/messages",
|
88
|
+
body=maybe_transform(
|
89
|
+
{
|
90
|
+
"content": content,
|
91
|
+
"task_id": task_id,
|
92
|
+
"streaming_status": streaming_status,
|
93
|
+
},
|
94
|
+
message_create_params.MessageCreateParams,
|
95
|
+
),
|
96
|
+
options=make_request_options(
|
97
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
98
|
+
),
|
99
|
+
cast_to=TaskMessage,
|
100
|
+
)
|
101
|
+
|
102
|
+
def retrieve(
|
103
|
+
self,
|
104
|
+
message_id: str,
|
105
|
+
*,
|
106
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
107
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
108
|
+
extra_headers: Headers | None = None,
|
109
|
+
extra_query: Query | None = None,
|
110
|
+
extra_body: Body | None = None,
|
111
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
112
|
+
) -> TaskMessage:
|
113
|
+
"""
|
114
|
+
Get Message
|
115
|
+
|
116
|
+
Args:
|
117
|
+
extra_headers: Send extra headers
|
118
|
+
|
119
|
+
extra_query: Add additional query parameters to the request
|
120
|
+
|
121
|
+
extra_body: Add additional JSON properties to the request
|
122
|
+
|
123
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
124
|
+
"""
|
125
|
+
if not message_id:
|
126
|
+
raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
|
127
|
+
return self._get(
|
128
|
+
f"/messages/{message_id}",
|
129
|
+
options=make_request_options(
|
130
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
131
|
+
),
|
132
|
+
cast_to=TaskMessage,
|
133
|
+
)
|
134
|
+
|
135
|
+
def update(
|
136
|
+
self,
|
137
|
+
message_id: str,
|
138
|
+
*,
|
139
|
+
content: TaskMessageContentParam,
|
140
|
+
task_id: str,
|
141
|
+
streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN,
|
142
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
143
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
144
|
+
extra_headers: Headers | None = None,
|
145
|
+
extra_query: Query | None = None,
|
146
|
+
extra_body: Body | None = None,
|
147
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
148
|
+
) -> TaskMessage:
|
149
|
+
"""
|
150
|
+
Update Message
|
151
|
+
|
152
|
+
Args:
|
153
|
+
extra_headers: Send extra headers
|
154
|
+
|
155
|
+
extra_query: Add additional query parameters to the request
|
156
|
+
|
157
|
+
extra_body: Add additional JSON properties to the request
|
158
|
+
|
159
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
160
|
+
"""
|
161
|
+
if not message_id:
|
162
|
+
raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
|
163
|
+
return self._put(
|
164
|
+
f"/messages/{message_id}",
|
165
|
+
body=maybe_transform(
|
166
|
+
{
|
167
|
+
"content": content,
|
168
|
+
"task_id": task_id,
|
169
|
+
"streaming_status": streaming_status,
|
170
|
+
},
|
171
|
+
message_update_params.MessageUpdateParams,
|
172
|
+
),
|
173
|
+
options=make_request_options(
|
174
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
175
|
+
),
|
176
|
+
cast_to=TaskMessage,
|
177
|
+
)
|
178
|
+
|
179
|
+
def list(
|
180
|
+
self,
|
181
|
+
*,
|
182
|
+
task_id: str,
|
183
|
+
limit: Optional[int] | NotGiven = NOT_GIVEN,
|
184
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
185
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
186
|
+
extra_headers: Headers | None = None,
|
187
|
+
extra_query: Query | None = None,
|
188
|
+
extra_body: Body | None = None,
|
189
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
190
|
+
) -> MessageListResponse:
|
191
|
+
"""
|
192
|
+
List Messages
|
193
|
+
|
194
|
+
Args:
|
195
|
+
extra_headers: Send extra headers
|
196
|
+
|
197
|
+
extra_query: Add additional query parameters to the request
|
198
|
+
|
199
|
+
extra_body: Add additional JSON properties to the request
|
200
|
+
|
201
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
202
|
+
"""
|
203
|
+
return self._get(
|
204
|
+
"/messages",
|
205
|
+
options=make_request_options(
|
206
|
+
extra_headers=extra_headers,
|
207
|
+
extra_query=extra_query,
|
208
|
+
extra_body=extra_body,
|
209
|
+
timeout=timeout,
|
210
|
+
query=maybe_transform(
|
211
|
+
{
|
212
|
+
"task_id": task_id,
|
213
|
+
"limit": limit,
|
214
|
+
},
|
215
|
+
message_list_params.MessageListParams,
|
216
|
+
),
|
217
|
+
),
|
218
|
+
cast_to=MessageListResponse,
|
219
|
+
)
|
220
|
+
|
221
|
+
|
222
|
+
class AsyncMessagesResource(AsyncAPIResource):
|
223
|
+
@cached_property
|
224
|
+
def batch(self) -> AsyncBatchResource:
|
225
|
+
return AsyncBatchResource(self._client)
|
226
|
+
|
227
|
+
@cached_property
|
228
|
+
def with_raw_response(self) -> AsyncMessagesResourceWithRawResponse:
|
229
|
+
"""
|
230
|
+
This property can be used as a prefix for any HTTP method call to return
|
231
|
+
the raw response object instead of the parsed content.
|
232
|
+
|
233
|
+
For more information, see https://www.github.com/scaleapi/agentex-python#accessing-raw-response-data-eg-headers
|
234
|
+
"""
|
235
|
+
return AsyncMessagesResourceWithRawResponse(self)
|
236
|
+
|
237
|
+
@cached_property
|
238
|
+
def with_streaming_response(self) -> AsyncMessagesResourceWithStreamingResponse:
|
239
|
+
"""
|
240
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
241
|
+
|
242
|
+
For more information, see https://www.github.com/scaleapi/agentex-python#with_streaming_response
|
243
|
+
"""
|
244
|
+
return AsyncMessagesResourceWithStreamingResponse(self)
|
245
|
+
|
246
|
+
async def create(
|
247
|
+
self,
|
248
|
+
*,
|
249
|
+
content: TaskMessageContentParam,
|
250
|
+
task_id: str,
|
251
|
+
streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN,
|
252
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
253
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
254
|
+
extra_headers: Headers | None = None,
|
255
|
+
extra_query: Query | None = None,
|
256
|
+
extra_body: Body | None = None,
|
257
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
258
|
+
) -> TaskMessage:
|
259
|
+
"""
|
260
|
+
Create Message
|
261
|
+
|
262
|
+
Args:
|
263
|
+
extra_headers: Send extra headers
|
264
|
+
|
265
|
+
extra_query: Add additional query parameters to the request
|
266
|
+
|
267
|
+
extra_body: Add additional JSON properties to the request
|
268
|
+
|
269
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
270
|
+
"""
|
271
|
+
return await self._post(
|
272
|
+
"/messages",
|
273
|
+
body=await async_maybe_transform(
|
274
|
+
{
|
275
|
+
"content": content,
|
276
|
+
"task_id": task_id,
|
277
|
+
"streaming_status": streaming_status,
|
278
|
+
},
|
279
|
+
message_create_params.MessageCreateParams,
|
280
|
+
),
|
281
|
+
options=make_request_options(
|
282
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
283
|
+
),
|
284
|
+
cast_to=TaskMessage,
|
285
|
+
)
|
286
|
+
|
287
|
+
async def retrieve(
|
288
|
+
self,
|
289
|
+
message_id: str,
|
290
|
+
*,
|
291
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
292
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
293
|
+
extra_headers: Headers | None = None,
|
294
|
+
extra_query: Query | None = None,
|
295
|
+
extra_body: Body | None = None,
|
296
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
297
|
+
) -> TaskMessage:
|
298
|
+
"""
|
299
|
+
Get Message
|
300
|
+
|
301
|
+
Args:
|
302
|
+
extra_headers: Send extra headers
|
303
|
+
|
304
|
+
extra_query: Add additional query parameters to the request
|
305
|
+
|
306
|
+
extra_body: Add additional JSON properties to the request
|
307
|
+
|
308
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
309
|
+
"""
|
310
|
+
if not message_id:
|
311
|
+
raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
|
312
|
+
return await self._get(
|
313
|
+
f"/messages/{message_id}",
|
314
|
+
options=make_request_options(
|
315
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
316
|
+
),
|
317
|
+
cast_to=TaskMessage,
|
318
|
+
)
|
319
|
+
|
320
|
+
async def update(
|
321
|
+
self,
|
322
|
+
message_id: str,
|
323
|
+
*,
|
324
|
+
content: TaskMessageContentParam,
|
325
|
+
task_id: str,
|
326
|
+
streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN,
|
327
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
328
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
329
|
+
extra_headers: Headers | None = None,
|
330
|
+
extra_query: Query | None = None,
|
331
|
+
extra_body: Body | None = None,
|
332
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
333
|
+
) -> TaskMessage:
|
334
|
+
"""
|
335
|
+
Update Message
|
336
|
+
|
337
|
+
Args:
|
338
|
+
extra_headers: Send extra headers
|
339
|
+
|
340
|
+
extra_query: Add additional query parameters to the request
|
341
|
+
|
342
|
+
extra_body: Add additional JSON properties to the request
|
343
|
+
|
344
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
345
|
+
"""
|
346
|
+
if not message_id:
|
347
|
+
raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}")
|
348
|
+
return await self._put(
|
349
|
+
f"/messages/{message_id}",
|
350
|
+
body=await async_maybe_transform(
|
351
|
+
{
|
352
|
+
"content": content,
|
353
|
+
"task_id": task_id,
|
354
|
+
"streaming_status": streaming_status,
|
355
|
+
},
|
356
|
+
message_update_params.MessageUpdateParams,
|
357
|
+
),
|
358
|
+
options=make_request_options(
|
359
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
360
|
+
),
|
361
|
+
cast_to=TaskMessage,
|
362
|
+
)
|
363
|
+
|
364
|
+
async def list(
|
365
|
+
self,
|
366
|
+
*,
|
367
|
+
task_id: str,
|
368
|
+
limit: Optional[int] | NotGiven = NOT_GIVEN,
|
369
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
370
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
371
|
+
extra_headers: Headers | None = None,
|
372
|
+
extra_query: Query | None = None,
|
373
|
+
extra_body: Body | None = None,
|
374
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
375
|
+
) -> MessageListResponse:
|
376
|
+
"""
|
377
|
+
List Messages
|
378
|
+
|
379
|
+
Args:
|
380
|
+
extra_headers: Send extra headers
|
381
|
+
|
382
|
+
extra_query: Add additional query parameters to the request
|
383
|
+
|
384
|
+
extra_body: Add additional JSON properties to the request
|
385
|
+
|
386
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
387
|
+
"""
|
388
|
+
return await self._get(
|
389
|
+
"/messages",
|
390
|
+
options=make_request_options(
|
391
|
+
extra_headers=extra_headers,
|
392
|
+
extra_query=extra_query,
|
393
|
+
extra_body=extra_body,
|
394
|
+
timeout=timeout,
|
395
|
+
query=await async_maybe_transform(
|
396
|
+
{
|
397
|
+
"task_id": task_id,
|
398
|
+
"limit": limit,
|
399
|
+
},
|
400
|
+
message_list_params.MessageListParams,
|
401
|
+
),
|
402
|
+
),
|
403
|
+
cast_to=MessageListResponse,
|
404
|
+
)
|
405
|
+
|
406
|
+
|
407
|
+
class MessagesResourceWithRawResponse:
|
408
|
+
def __init__(self, messages: MessagesResource) -> None:
|
409
|
+
self._messages = messages
|
410
|
+
|
411
|
+
self.create = to_raw_response_wrapper(
|
412
|
+
messages.create,
|
413
|
+
)
|
414
|
+
self.retrieve = to_raw_response_wrapper(
|
415
|
+
messages.retrieve,
|
416
|
+
)
|
417
|
+
self.update = to_raw_response_wrapper(
|
418
|
+
messages.update,
|
419
|
+
)
|
420
|
+
self.list = to_raw_response_wrapper(
|
421
|
+
messages.list,
|
422
|
+
)
|
423
|
+
|
424
|
+
@cached_property
|
425
|
+
def batch(self) -> BatchResourceWithRawResponse:
|
426
|
+
return BatchResourceWithRawResponse(self._messages.batch)
|
427
|
+
|
428
|
+
|
429
|
+
class AsyncMessagesResourceWithRawResponse:
|
430
|
+
def __init__(self, messages: AsyncMessagesResource) -> None:
|
431
|
+
self._messages = messages
|
432
|
+
|
433
|
+
self.create = async_to_raw_response_wrapper(
|
434
|
+
messages.create,
|
435
|
+
)
|
436
|
+
self.retrieve = async_to_raw_response_wrapper(
|
437
|
+
messages.retrieve,
|
438
|
+
)
|
439
|
+
self.update = async_to_raw_response_wrapper(
|
440
|
+
messages.update,
|
441
|
+
)
|
442
|
+
self.list = async_to_raw_response_wrapper(
|
443
|
+
messages.list,
|
444
|
+
)
|
445
|
+
|
446
|
+
@cached_property
|
447
|
+
def batch(self) -> AsyncBatchResourceWithRawResponse:
|
448
|
+
return AsyncBatchResourceWithRawResponse(self._messages.batch)
|
449
|
+
|
450
|
+
|
451
|
+
class MessagesResourceWithStreamingResponse:
|
452
|
+
def __init__(self, messages: MessagesResource) -> None:
|
453
|
+
self._messages = messages
|
454
|
+
|
455
|
+
self.create = to_streamed_response_wrapper(
|
456
|
+
messages.create,
|
457
|
+
)
|
458
|
+
self.retrieve = to_streamed_response_wrapper(
|
459
|
+
messages.retrieve,
|
460
|
+
)
|
461
|
+
self.update = to_streamed_response_wrapper(
|
462
|
+
messages.update,
|
463
|
+
)
|
464
|
+
self.list = to_streamed_response_wrapper(
|
465
|
+
messages.list,
|
466
|
+
)
|
467
|
+
|
468
|
+
@cached_property
|
469
|
+
def batch(self) -> BatchResourceWithStreamingResponse:
|
470
|
+
return BatchResourceWithStreamingResponse(self._messages.batch)
|
471
|
+
|
472
|
+
|
473
|
+
class AsyncMessagesResourceWithStreamingResponse:
|
474
|
+
def __init__(self, messages: AsyncMessagesResource) -> None:
|
475
|
+
self._messages = messages
|
476
|
+
|
477
|
+
self.create = async_to_streamed_response_wrapper(
|
478
|
+
messages.create,
|
479
|
+
)
|
480
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
481
|
+
messages.retrieve,
|
482
|
+
)
|
483
|
+
self.update = async_to_streamed_response_wrapper(
|
484
|
+
messages.update,
|
485
|
+
)
|
486
|
+
self.list = async_to_streamed_response_wrapper(
|
487
|
+
messages.list,
|
488
|
+
)
|
489
|
+
|
490
|
+
@cached_property
|
491
|
+
def batch(self) -> AsyncBatchResourceWithStreamingResponse:
|
492
|
+
return AsyncBatchResourceWithStreamingResponse(self._messages.batch)
|