snowflake-cortex-agent-sdk 0.0.1__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.
- cortex_agent_sdk/__init__.py +180 -0
- cortex_agent_sdk/_base_client.py +783 -0
- cortex_agent_sdk/_constants.py +51 -0
- cortex_agent_sdk/_generated/__init__.py +0 -0
- cortex_agent_sdk/_generated/agent_runs.py +1061 -0
- cortex_agent_sdk/_generated/data_agent.py +1309 -0
- cortex_agent_sdk/_generated/events.py +2657 -0
- cortex_agent_sdk/_generated/lite_agent.py +1050 -0
- cortex_agent_sdk/_generated/threads.py +238 -0
- cortex_agent_sdk/_request_options.py +158 -0
- cortex_agent_sdk/_resource.py +103 -0
- cortex_agent_sdk/_transport.py +111 -0
- cortex_agent_sdk/_types.py +96 -0
- cortex_agent_sdk/_version.py +12 -0
- cortex_agent_sdk/api_response.py +51 -0
- cortex_agent_sdk/auth.py +245 -0
- cortex_agent_sdk/client.py +461 -0
- cortex_agent_sdk/constants.py +137 -0
- cortex_agent_sdk/conversation.py +428 -0
- cortex_agent_sdk/cortexcode/__init__.py +436 -0
- cortex_agent_sdk/cortexcode/_errors.py +66 -0
- cortex_agent_sdk/cortexcode/_internal/__init__.py +0 -0
- cortex_agent_sdk/cortexcode/_internal/message_parser.py +261 -0
- cortex_agent_sdk/cortexcode/_internal/query.py +682 -0
- cortex_agent_sdk/cortexcode/_internal/transport/__init__.py +62 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api.py +988 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/__init__.py +1 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/connection.py +232 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/messages.py +72 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/options.py +100 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/settings.py +31 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/tools.py +55 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/trace.py +99 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/types.py +86 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/utils.py +34 -0
- cortex_agent_sdk/cortexcode/_internal/transport/api_support/wire.py +530 -0
- cortex_agent_sdk/cortexcode/_internal/transport/subprocess_cli.py +625 -0
- cortex_agent_sdk/cortexcode/client.py +384 -0
- cortex_agent_sdk/cortexcode/fork_session.py +103 -0
- cortex_agent_sdk/cortexcode/py.typed +0 -0
- cortex_agent_sdk/cortexcode/query.py +73 -0
- cortex_agent_sdk/cortexcode/threads.py +190 -0
- cortex_agent_sdk/cortexcode/types.py +1299 -0
- cortex_agent_sdk/errors.py +146 -0
- cortex_agent_sdk/models.py +466 -0
- cortex_agent_sdk/origin.py +20 -0
- cortex_agent_sdk/py.typed +0 -0
- cortex_agent_sdk/resources/__init__.py +22 -0
- cortex_agent_sdk/resources/agent.py +680 -0
- cortex_agent_sdk/resources/coding_agent.py +343 -0
- cortex_agent_sdk/resources/feedback.py +166 -0
- cortex_agent_sdk/resources/runs.py +146 -0
- cortex_agent_sdk/resources/threads.py +429 -0
- cortex_agent_sdk/stream.py +12 -0
- cortex_agent_sdk/streaming/__init__.py +15 -0
- cortex_agent_sdk/streaming/parser.py +189 -0
- cortex_agent_sdk/streaming/run_stream.py +524 -0
- cortex_agent_sdk/threads_page.py +180 -0
- cortex_agent_sdk/views/__init__.py +17 -0
- cortex_agent_sdk/views/agent_response.py +236 -0
- cortex_agent_sdk/views/async_run.py +317 -0
- cortex_agent_sdk/views/content_view.py +144 -0
- cortex_agent_sdk/views/thread_message.py +122 -0
- snowflake_cortex_agent_sdk-0.0.1.dist-info/METADATA +194 -0
- snowflake_cortex_agent_sdk-0.0.1.dist-info/RECORD +67 -0
- snowflake_cortex_agent_sdk-0.0.1.dist-info/WHEEL +4 -0
- snowflake_cortex_agent_sdk-0.0.1.dist-info/licenses/LICENSE +1 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"""Snowflake Cortex Agent SDK (Python).
|
|
2
|
+
|
|
3
|
+
Sync::
|
|
4
|
+
|
|
5
|
+
from cortex_agent_sdk import Conversation, CortexAgentClient
|
|
6
|
+
|
|
7
|
+
client = CortexAgentClient(account="myacct", auth="<pat>")
|
|
8
|
+
convo = Conversation.create(client)
|
|
9
|
+
print(convo.ask("What is Snowflake Arctic?").text)
|
|
10
|
+
|
|
11
|
+
Async::
|
|
12
|
+
|
|
13
|
+
import asyncio
|
|
14
|
+
from cortex_agent_sdk import AsyncConversation, AsyncCortexAgentClient
|
|
15
|
+
|
|
16
|
+
async def main():
|
|
17
|
+
async with AsyncCortexAgentClient(account="myacct", auth="<pat>") as client:
|
|
18
|
+
convo = await AsyncConversation.create(client)
|
|
19
|
+
print((await convo.ask("What is Snowflake Arctic?")).text)
|
|
20
|
+
|
|
21
|
+
asyncio.run(main())
|
|
22
|
+
|
|
23
|
+
Start with ``docs/01-getting-started.md``.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
from __future__ import annotations
|
|
27
|
+
|
|
28
|
+
from . import models
|
|
29
|
+
from ._constants import DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT
|
|
30
|
+
from ._request_options import RequestOptions
|
|
31
|
+
from ._transport import AuthRefreshContext, RetryPolicy
|
|
32
|
+
from ._types import NOT_GIVEN, NotGiven, Omit, not_given, omit
|
|
33
|
+
from ._version import __title__, __version__
|
|
34
|
+
from .api_response import APIResponse, ResponseCarrier
|
|
35
|
+
from .auth import (
|
|
36
|
+
Authenticator,
|
|
37
|
+
CallableAuth,
|
|
38
|
+
KeyPairJwtAuth,
|
|
39
|
+
OAuthAuth,
|
|
40
|
+
PatAuth,
|
|
41
|
+
SnowflakeSessionTokenAuth,
|
|
42
|
+
SnowflakeTokenAuth,
|
|
43
|
+
SnowflakeTokenType,
|
|
44
|
+
)
|
|
45
|
+
from .client import AsyncCortexAgentClient, CortexAgentClient
|
|
46
|
+
from .constants import ContentType, ContentTypeName, EventType, EventTypeName
|
|
47
|
+
from .conversation import AsyncConversation, Conversation
|
|
48
|
+
from .errors import (
|
|
49
|
+
APIConnectionAbortedError,
|
|
50
|
+
APIConnectionError,
|
|
51
|
+
APIStatusError,
|
|
52
|
+
APITimeoutError,
|
|
53
|
+
AuthenticationError,
|
|
54
|
+
BadRequestError,
|
|
55
|
+
ConflictError,
|
|
56
|
+
CortexAgentAPIError,
|
|
57
|
+
CortexAgentError,
|
|
58
|
+
InternalServerError,
|
|
59
|
+
NotFoundError,
|
|
60
|
+
PermissionDeniedError,
|
|
61
|
+
RateLimitError,
|
|
62
|
+
UnprocessableEntityError,
|
|
63
|
+
create_api_error,
|
|
64
|
+
)
|
|
65
|
+
from .resources.agent import (
|
|
66
|
+
AgentResource,
|
|
67
|
+
AgentSchemaTarget,
|
|
68
|
+
AsyncAgentResource,
|
|
69
|
+
CreateMode,
|
|
70
|
+
DataAgentTarget,
|
|
71
|
+
DataAgentVersionTarget,
|
|
72
|
+
)
|
|
73
|
+
from .resources.coding_agent import (
|
|
74
|
+
AsyncCodingAgentResource,
|
|
75
|
+
CodingAgentPermissionPolicy,
|
|
76
|
+
CodingAgentResource,
|
|
77
|
+
expand_coding_agent_request,
|
|
78
|
+
)
|
|
79
|
+
from .resources.feedback import AsyncFeedbackResource, FeedbackResource
|
|
80
|
+
from .resources.runs import AsyncRunsResource, RunsResource
|
|
81
|
+
from .resources.threads import AsyncThreadsResource, ThreadsResource
|
|
82
|
+
from .streaming.parser import AgentEvent, aiter_sse, iter_sse
|
|
83
|
+
from .streaming.run_stream import AgentRunStream, AsyncAgentRunStream, StreamEvent
|
|
84
|
+
from .threads_page import AsyncThreadsPage, ThreadsPage
|
|
85
|
+
from .views.agent_response import AgentResponseView
|
|
86
|
+
from .views.async_run import AsyncBackgroundRun, AsyncRun, BackgroundRun
|
|
87
|
+
from .views.content_view import MessageContentView
|
|
88
|
+
from .views.thread_message import ThreadMessage, ThreadMessageView
|
|
89
|
+
|
|
90
|
+
__all__ = [
|
|
91
|
+
# Core clients + config
|
|
92
|
+
"APIResponse",
|
|
93
|
+
"AuthRefreshContext",
|
|
94
|
+
"AsyncCortexAgentClient",
|
|
95
|
+
"CortexAgentClient",
|
|
96
|
+
"DEFAULT_MAX_RETRIES",
|
|
97
|
+
"DEFAULT_TIMEOUT",
|
|
98
|
+
"RequestOptions",
|
|
99
|
+
"ResponseCarrier",
|
|
100
|
+
"RetryPolicy",
|
|
101
|
+
# Sentinels
|
|
102
|
+
"NOT_GIVEN",
|
|
103
|
+
"NotGiven",
|
|
104
|
+
"Omit",
|
|
105
|
+
"not_given",
|
|
106
|
+
"omit",
|
|
107
|
+
# Auth
|
|
108
|
+
"Authenticator",
|
|
109
|
+
"CallableAuth",
|
|
110
|
+
"KeyPairJwtAuth",
|
|
111
|
+
"OAuthAuth",
|
|
112
|
+
"PatAuth",
|
|
113
|
+
"SnowflakeSessionTokenAuth",
|
|
114
|
+
"SnowflakeTokenAuth",
|
|
115
|
+
"SnowflakeTokenType",
|
|
116
|
+
# Errors
|
|
117
|
+
"APIConnectionAbortedError",
|
|
118
|
+
"APIConnectionError",
|
|
119
|
+
"APIStatusError",
|
|
120
|
+
"APITimeoutError",
|
|
121
|
+
"AuthenticationError",
|
|
122
|
+
"BadRequestError",
|
|
123
|
+
"ConflictError",
|
|
124
|
+
"CortexAgentAPIError",
|
|
125
|
+
"CortexAgentError",
|
|
126
|
+
"InternalServerError",
|
|
127
|
+
"NotFoundError",
|
|
128
|
+
"PermissionDeniedError",
|
|
129
|
+
"RateLimitError",
|
|
130
|
+
"UnprocessableEntityError",
|
|
131
|
+
"create_api_error",
|
|
132
|
+
# Discriminator constants
|
|
133
|
+
"ContentType",
|
|
134
|
+
"ContentTypeName",
|
|
135
|
+
"EventType",
|
|
136
|
+
"EventTypeName",
|
|
137
|
+
# Streaming
|
|
138
|
+
"AgentEvent",
|
|
139
|
+
"AgentRunStream",
|
|
140
|
+
"AsyncAgentRunStream",
|
|
141
|
+
"StreamEvent",
|
|
142
|
+
"aiter_sse",
|
|
143
|
+
"iter_sse",
|
|
144
|
+
# Pagination
|
|
145
|
+
"AsyncThreadsPage",
|
|
146
|
+
"ThreadsPage",
|
|
147
|
+
# Resources
|
|
148
|
+
"AgentResource",
|
|
149
|
+
"AgentSchemaTarget",
|
|
150
|
+
"AsyncAgentResource",
|
|
151
|
+
"AsyncCodingAgentResource",
|
|
152
|
+
"AsyncFeedbackResource",
|
|
153
|
+
"AsyncRunsResource",
|
|
154
|
+
"AsyncThreadsResource",
|
|
155
|
+
"CodingAgentPermissionPolicy",
|
|
156
|
+
"CodingAgentResource",
|
|
157
|
+
"CreateMode",
|
|
158
|
+
"DataAgentTarget",
|
|
159
|
+
"DataAgentVersionTarget",
|
|
160
|
+
"FeedbackResource",
|
|
161
|
+
"RunsResource",
|
|
162
|
+
"ThreadsResource",
|
|
163
|
+
"expand_coding_agent_request",
|
|
164
|
+
# Response / message views
|
|
165
|
+
"AgentResponseView",
|
|
166
|
+
"AsyncBackgroundRun",
|
|
167
|
+
"AsyncRun",
|
|
168
|
+
"BackgroundRun",
|
|
169
|
+
"MessageContentView",
|
|
170
|
+
"ThreadMessage",
|
|
171
|
+
"ThreadMessageView",
|
|
172
|
+
# Conversation
|
|
173
|
+
"AsyncConversation",
|
|
174
|
+
"Conversation",
|
|
175
|
+
# Generated models
|
|
176
|
+
"models",
|
|
177
|
+
# Metadata
|
|
178
|
+
"__title__",
|
|
179
|
+
"__version__",
|
|
180
|
+
]
|