googlechatai 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.
- googlechatai/__init__.py +403 -0
- googlechatai/actions/__init__.py +697 -0
- googlechatai/adapters/__init__.py +6 -0
- googlechatai/adapters/asgi.py +102 -0
- googlechatai/adapters/fastapi.py +76 -0
- googlechatai/agent_interop.py +696 -0
- googlechatai/attachments/__init__.py +2773 -0
- googlechatai/cache/__init__.py +290 -0
- googlechatai/capabilities/__init__.py +622 -0
- googlechatai/cards/__init__.py +2401 -0
- googlechatai/chat_links/__init__.py +1433 -0
- googlechatai/events.py +635 -0
- googlechatai/execute/__init__.py +411 -0
- googlechatai/identity/__init__.py +301 -0
- googlechatai/ingestion/__init__.py +641 -0
- googlechatai/message_ast/__init__.py +890 -0
- googlechatai/messages/__init__.py +1917 -0
- googlechatai/pins/__init__.py +269 -0
- googlechatai/py.typed +1 -0
- googlechatai/queues/__init__.py +262 -0
- googlechatai/reactions/__init__.py +398 -0
- googlechatai/router/__init__.py +14 -0
- googlechatai/router/attachments.py +43 -0
- googlechatai/router/context.py +159 -0
- googlechatai/router/history.py +44 -0
- googlechatai/router/identity.py +34 -0
- googlechatai/router/messages.py +36 -0
- googlechatai/router/replies.py +121 -0
- googlechatai/router/runtime.py +770 -0
- googlechatai/router/time_context.py +26 -0
- googlechatai/streaming/__init__.py +1066 -0
- googlechatai/threads/__init__.py +1267 -0
- googlechatai/token_store/__init__.py +434 -0
- googlechatai/transport/__init__.py +747 -0
- googlechatai/verify/__init__.py +508 -0
- googlechatai/workspace_events/__init__.py +350 -0
- googlechatai-0.0.1.dist-info/METADATA +57 -0
- googlechatai-0.0.1.dist-info/RECORD +41 -0
- googlechatai-0.0.1.dist-info/WHEEL +4 -0
- googlechatai-0.0.1.dist-info/licenses/LICENSE +201 -0
- googlechatai-0.0.1.dist-info/licenses/NOTICE +7 -0
googlechatai/__init__.py
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
"""Google Chat AI SDK Python package."""
|
|
2
|
+
|
|
3
|
+
from .actions import normalize_action, render_action_system_notes
|
|
4
|
+
from .agent_interop import normalize_agent_response, plan_agent_response_message
|
|
5
|
+
from .attachments import (
|
|
6
|
+
CHAT_MEDIA_UPLOAD_MAX_BYTES,
|
|
7
|
+
DEFAULT_ATTACHMENT_DOWNLOAD_MAX_BYTES,
|
|
8
|
+
DEFAULT_DRIVE_EXPORT_MAX_BYTES,
|
|
9
|
+
DEFAULT_TRANSCRIPTION_MAX_BYTES,
|
|
10
|
+
DRIVE_READONLY_SCOPE,
|
|
11
|
+
classify_media_kind,
|
|
12
|
+
collect_attachments_from_context,
|
|
13
|
+
collect_drive_link_candidates,
|
|
14
|
+
create_drive_export_plan,
|
|
15
|
+
create_drive_link_retrieval_plan,
|
|
16
|
+
create_download_plan,
|
|
17
|
+
create_gemini_transcription_provider,
|
|
18
|
+
create_openai_transcription_provider,
|
|
19
|
+
create_upload_plan,
|
|
20
|
+
default_drive_export_mime_type,
|
|
21
|
+
evaluate_attachment_policy,
|
|
22
|
+
normalize_attachment,
|
|
23
|
+
normalize_attachments,
|
|
24
|
+
normalize_attachments_from_message,
|
|
25
|
+
plan_attachment_pipeline,
|
|
26
|
+
parse_attachment_content,
|
|
27
|
+
render_attachment_context_parts,
|
|
28
|
+
sanitize_filename,
|
|
29
|
+
summarize_transcription_evidence,
|
|
30
|
+
transcribe_audio,
|
|
31
|
+
)
|
|
32
|
+
from .cache import (
|
|
33
|
+
FileArtifactCache,
|
|
34
|
+
InMemoryArtifactCache,
|
|
35
|
+
build_artifact_cache_key,
|
|
36
|
+
build_negative_cache_entry,
|
|
37
|
+
hash_bytes,
|
|
38
|
+
)
|
|
39
|
+
from .capabilities import (
|
|
40
|
+
explain_chat_capability,
|
|
41
|
+
explain_google_chat_error,
|
|
42
|
+
plan_chat_permission,
|
|
43
|
+
)
|
|
44
|
+
from .chat_links import (
|
|
45
|
+
CHAT_APP_MESSAGES_READONLY_SCOPE,
|
|
46
|
+
CHAT_BOT_SCOPE,
|
|
47
|
+
CHAT_MESSAGES_READONLY_SCOPE,
|
|
48
|
+
CHAT_SPACES_READONLY_SCOPE,
|
|
49
|
+
build_chat_link_cache_key,
|
|
50
|
+
collect_chat_link_candidates,
|
|
51
|
+
create_chat_link_retrieval_plan,
|
|
52
|
+
)
|
|
53
|
+
from .cards import (
|
|
54
|
+
DEFAULT_CARD_ACTION_STATE_PARAMETER,
|
|
55
|
+
build_approval_card,
|
|
56
|
+
build_card_navigation_response,
|
|
57
|
+
build_card_message,
|
|
58
|
+
build_create_message_response,
|
|
59
|
+
build_dialog,
|
|
60
|
+
build_error_card,
|
|
61
|
+
build_feedback_accessory_message,
|
|
62
|
+
build_feedback_accessory_widgets,
|
|
63
|
+
build_feedback_card,
|
|
64
|
+
build_open_dialog_response,
|
|
65
|
+
build_progress_card,
|
|
66
|
+
build_sources_card,
|
|
67
|
+
build_streaming_status_card,
|
|
68
|
+
build_thinking_card,
|
|
69
|
+
build_tool_status_card,
|
|
70
|
+
build_update_card_response,
|
|
71
|
+
decode_card_action_state,
|
|
72
|
+
encode_card_action_state,
|
|
73
|
+
lint_card_payload,
|
|
74
|
+
push_card,
|
|
75
|
+
read_card_action_state,
|
|
76
|
+
render_card_action_note,
|
|
77
|
+
route_card_action,
|
|
78
|
+
summarize_card_action,
|
|
79
|
+
summarize_cards,
|
|
80
|
+
translate_card_payload,
|
|
81
|
+
update_card,
|
|
82
|
+
validate_card_message,
|
|
83
|
+
with_card_action_state,
|
|
84
|
+
)
|
|
85
|
+
from .events import InvalidChatEventError, normalize_event
|
|
86
|
+
from .identity import (
|
|
87
|
+
DIRECTORY_USER_READONLY_SCOPE,
|
|
88
|
+
FileIdentityCache,
|
|
89
|
+
InMemoryIdentityCache,
|
|
90
|
+
build_directory_users_list_plan,
|
|
91
|
+
render_identity_system_note,
|
|
92
|
+
resolve_human_identity,
|
|
93
|
+
sync_directory_users_to_cache,
|
|
94
|
+
)
|
|
95
|
+
from .ingestion import plan_chat_ingestion, process_polling_ingestion_page
|
|
96
|
+
from .message_ast import normalize_message
|
|
97
|
+
from .messages import (
|
|
98
|
+
build_buffered_stream_patches,
|
|
99
|
+
build_update_mask,
|
|
100
|
+
generate_client_message_id,
|
|
101
|
+
generate_request_id,
|
|
102
|
+
hydrate_placeholder_response_handle,
|
|
103
|
+
InMemoryAsyncResponseQueue,
|
|
104
|
+
plan_async_response,
|
|
105
|
+
plan_buffered_placeholder_completion,
|
|
106
|
+
plan_buffered_stream_message,
|
|
107
|
+
plan_complete_placeholder_response,
|
|
108
|
+
plan_delete_app_message,
|
|
109
|
+
plan_edit_message,
|
|
110
|
+
plan_find_or_setup_dm,
|
|
111
|
+
plan_placeholder_response,
|
|
112
|
+
plan_reply_in_thread,
|
|
113
|
+
plan_reply_to_event,
|
|
114
|
+
plan_replace_cards,
|
|
115
|
+
plan_search_messages,
|
|
116
|
+
plan_send_to_space,
|
|
117
|
+
plan_send_to_user,
|
|
118
|
+
plan_start_thread,
|
|
119
|
+
plan_stream_message,
|
|
120
|
+
resolve_reply_target,
|
|
121
|
+
select_placeholder_text,
|
|
122
|
+
)
|
|
123
|
+
from .reactions import (
|
|
124
|
+
CHAT_REACTIONS_READONLY_SCOPE,
|
|
125
|
+
CHAT_REACTIONS_SCOPE,
|
|
126
|
+
build_reaction_filter_for_emoji,
|
|
127
|
+
feedback_rating_to_emoji,
|
|
128
|
+
plan_add_reaction,
|
|
129
|
+
plan_delete_reaction,
|
|
130
|
+
plan_feedback_reaction,
|
|
131
|
+
plan_list_reactions,
|
|
132
|
+
)
|
|
133
|
+
from .router import ChatResponse, GoogleChatAI, HandlerContext, ReplyBuilder, json_response
|
|
134
|
+
from .threads import (
|
|
135
|
+
build_conversation_context,
|
|
136
|
+
build_conversation_context_with_identity,
|
|
137
|
+
plan_read_space_context,
|
|
138
|
+
plan_read_thread_context,
|
|
139
|
+
render_ai_context,
|
|
140
|
+
)
|
|
141
|
+
from .transport import (
|
|
142
|
+
DuplicateEventGuardResult,
|
|
143
|
+
FileIdempotencyStore,
|
|
144
|
+
IdempotencyClaim,
|
|
145
|
+
InMemoryIdempotencyStore,
|
|
146
|
+
RetryDecision,
|
|
147
|
+
RetryDecisionInput,
|
|
148
|
+
RetryPolicyOptions,
|
|
149
|
+
RetryingChatClient,
|
|
150
|
+
RetryingJsonResponse,
|
|
151
|
+
build_retry_decision,
|
|
152
|
+
create_retrying_chat_client,
|
|
153
|
+
guard_duplicate_event_delivery,
|
|
154
|
+
is_replay_safe,
|
|
155
|
+
parse_retry_after_ms,
|
|
156
|
+
request_json_with_retry,
|
|
157
|
+
)
|
|
158
|
+
from .execute import (
|
|
159
|
+
CHAT_API_BASE_URL,
|
|
160
|
+
DEFAULT_PLACEHOLDER_RESOLVERS,
|
|
161
|
+
execute_chat_plan,
|
|
162
|
+
)
|
|
163
|
+
from .pins import (
|
|
164
|
+
CHAT_PIN_DOCS_LISTED_NOTE,
|
|
165
|
+
PIN_MESSAGES_SCOPE,
|
|
166
|
+
plan_ensure_message_pinned,
|
|
167
|
+
plan_list_message_pins,
|
|
168
|
+
plan_pin_message,
|
|
169
|
+
plan_unpin_message,
|
|
170
|
+
)
|
|
171
|
+
from .queues import (
|
|
172
|
+
AsyncResponseQueue,
|
|
173
|
+
CloudTasksQueueAdapter,
|
|
174
|
+
FileAsyncResponseQueue,
|
|
175
|
+
PubSubQueueAdapter,
|
|
176
|
+
)
|
|
177
|
+
from .streaming import (
|
|
178
|
+
FileStreamCancellationRegistry,
|
|
179
|
+
InMemoryStreamCancellationRegistry,
|
|
180
|
+
advance_stream_scheduler,
|
|
181
|
+
astream_chat_reply,
|
|
182
|
+
create_chat_request_applier,
|
|
183
|
+
create_stream_scheduler_state,
|
|
184
|
+
replay_stream_scheduler,
|
|
185
|
+
stream_chat_reply,
|
|
186
|
+
)
|
|
187
|
+
from .token_store import (
|
|
188
|
+
FileTokenStore,
|
|
189
|
+
InMemoryTokenStore,
|
|
190
|
+
SecretManagerTokenStore,
|
|
191
|
+
TokenRecord,
|
|
192
|
+
TokenStore,
|
|
193
|
+
get_access_token_from_store,
|
|
194
|
+
)
|
|
195
|
+
from .verify import (
|
|
196
|
+
GOOGLE_CHAT_JWKS_URL,
|
|
197
|
+
GOOGLE_CHAT_TOKEN_ISSUER,
|
|
198
|
+
GOOGLE_OIDC_ISSUERS,
|
|
199
|
+
GOOGLE_OIDC_JWKS_URL,
|
|
200
|
+
GoogleChatTokenVerifier,
|
|
201
|
+
bearer_token_from_authorization,
|
|
202
|
+
create_google_chat_token_verifier,
|
|
203
|
+
create_pubsub_push_verifier,
|
|
204
|
+
decode_jwt_without_verifying,
|
|
205
|
+
verify_chat_request_authorization,
|
|
206
|
+
verify_google_chat_token,
|
|
207
|
+
)
|
|
208
|
+
from .workspace_events import (
|
|
209
|
+
FileWorkspaceEventsCheckpointStore,
|
|
210
|
+
InMemoryWorkspaceEventsCheckpointStore,
|
|
211
|
+
parse_pubsub_pull_payload,
|
|
212
|
+
parse_pubsub_push_payload,
|
|
213
|
+
parse_workspace_chat_resource_event,
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
__all__ = [
|
|
217
|
+
"CHAT_API_BASE_URL",
|
|
218
|
+
"DEFAULT_PLACEHOLDER_RESOLVERS",
|
|
219
|
+
"execute_chat_plan",
|
|
220
|
+
"CHAT_PIN_DOCS_LISTED_NOTE",
|
|
221
|
+
"PIN_MESSAGES_SCOPE",
|
|
222
|
+
"plan_ensure_message_pinned",
|
|
223
|
+
"plan_list_message_pins",
|
|
224
|
+
"plan_pin_message",
|
|
225
|
+
"plan_unpin_message",
|
|
226
|
+
"AsyncResponseQueue",
|
|
227
|
+
"CloudTasksQueueAdapter",
|
|
228
|
+
"FileAsyncResponseQueue",
|
|
229
|
+
"PubSubQueueAdapter",
|
|
230
|
+
"FileStreamCancellationRegistry",
|
|
231
|
+
"InMemoryStreamCancellationRegistry",
|
|
232
|
+
"advance_stream_scheduler",
|
|
233
|
+
"astream_chat_reply",
|
|
234
|
+
"create_chat_request_applier",
|
|
235
|
+
"create_stream_scheduler_state",
|
|
236
|
+
"replay_stream_scheduler",
|
|
237
|
+
"stream_chat_reply",
|
|
238
|
+
"FileTokenStore",
|
|
239
|
+
"InMemoryTokenStore",
|
|
240
|
+
"SecretManagerTokenStore",
|
|
241
|
+
"TokenRecord",
|
|
242
|
+
"TokenStore",
|
|
243
|
+
"get_access_token_from_store",
|
|
244
|
+
"GOOGLE_CHAT_JWKS_URL",
|
|
245
|
+
"GOOGLE_CHAT_TOKEN_ISSUER",
|
|
246
|
+
"GOOGLE_OIDC_ISSUERS",
|
|
247
|
+
"GOOGLE_OIDC_JWKS_URL",
|
|
248
|
+
"GoogleChatTokenVerifier",
|
|
249
|
+
"bearer_token_from_authorization",
|
|
250
|
+
"create_google_chat_token_verifier",
|
|
251
|
+
"create_pubsub_push_verifier",
|
|
252
|
+
"decode_jwt_without_verifying",
|
|
253
|
+
"verify_chat_request_authorization",
|
|
254
|
+
"verify_google_chat_token",
|
|
255
|
+
"plan_replace_cards",
|
|
256
|
+
"plan_search_messages",
|
|
257
|
+
"ChatResponse",
|
|
258
|
+
"CHAT_MEDIA_UPLOAD_MAX_BYTES",
|
|
259
|
+
"CHAT_APP_MESSAGES_READONLY_SCOPE",
|
|
260
|
+
"CHAT_BOT_SCOPE",
|
|
261
|
+
"CHAT_MESSAGES_READONLY_SCOPE",
|
|
262
|
+
"CHAT_REACTIONS_READONLY_SCOPE",
|
|
263
|
+
"CHAT_REACTIONS_SCOPE",
|
|
264
|
+
"CHAT_SPACES_READONLY_SCOPE",
|
|
265
|
+
"DIRECTORY_USER_READONLY_SCOPE",
|
|
266
|
+
"DEFAULT_ATTACHMENT_DOWNLOAD_MAX_BYTES",
|
|
267
|
+
"DEFAULT_CARD_ACTION_STATE_PARAMETER",
|
|
268
|
+
"DEFAULT_DRIVE_EXPORT_MAX_BYTES",
|
|
269
|
+
"DEFAULT_TRANSCRIPTION_MAX_BYTES",
|
|
270
|
+
"DRIVE_READONLY_SCOPE",
|
|
271
|
+
"DuplicateEventGuardResult",
|
|
272
|
+
"FileArtifactCache",
|
|
273
|
+
"FileIdentityCache",
|
|
274
|
+
"FileWorkspaceEventsCheckpointStore",
|
|
275
|
+
"FileIdempotencyStore",
|
|
276
|
+
"GoogleChatAI",
|
|
277
|
+
"HandlerContext",
|
|
278
|
+
"IdempotencyClaim",
|
|
279
|
+
"InMemoryArtifactCache",
|
|
280
|
+
"InMemoryIdentityCache",
|
|
281
|
+
"InMemoryIdempotencyStore",
|
|
282
|
+
"InMemoryWorkspaceEventsCheckpointStore",
|
|
283
|
+
"InvalidChatEventError",
|
|
284
|
+
"ReplyBuilder",
|
|
285
|
+
"RetryDecision",
|
|
286
|
+
"RetryDecisionInput",
|
|
287
|
+
"RetryPolicyOptions",
|
|
288
|
+
"RetryingChatClient",
|
|
289
|
+
"RetryingJsonResponse",
|
|
290
|
+
"build_approval_card",
|
|
291
|
+
"build_artifact_cache_key",
|
|
292
|
+
"build_card_navigation_response",
|
|
293
|
+
"build_card_message",
|
|
294
|
+
"build_create_message_response",
|
|
295
|
+
"build_conversation_context",
|
|
296
|
+
"build_conversation_context_with_identity",
|
|
297
|
+
"build_directory_users_list_plan",
|
|
298
|
+
"build_dialog",
|
|
299
|
+
"build_error_card",
|
|
300
|
+
"build_feedback_accessory_message",
|
|
301
|
+
"build_feedback_accessory_widgets",
|
|
302
|
+
"build_feedback_card",
|
|
303
|
+
"build_buffered_stream_patches",
|
|
304
|
+
"build_chat_link_cache_key",
|
|
305
|
+
"build_open_dialog_response",
|
|
306
|
+
"build_progress_card",
|
|
307
|
+
"build_sources_card",
|
|
308
|
+
"build_streaming_status_card",
|
|
309
|
+
"build_thinking_card",
|
|
310
|
+
"build_tool_status_card",
|
|
311
|
+
"build_retry_decision",
|
|
312
|
+
"build_negative_cache_entry",
|
|
313
|
+
"build_reaction_filter_for_emoji",
|
|
314
|
+
"build_update_card_response",
|
|
315
|
+
"build_update_mask",
|
|
316
|
+
"classify_media_kind",
|
|
317
|
+
"collect_attachments_from_context",
|
|
318
|
+
"collect_drive_link_candidates",
|
|
319
|
+
"collect_chat_link_candidates",
|
|
320
|
+
"create_drive_export_plan",
|
|
321
|
+
"create_drive_link_retrieval_plan",
|
|
322
|
+
"create_download_plan",
|
|
323
|
+
"create_gemini_transcription_provider",
|
|
324
|
+
"create_openai_transcription_provider",
|
|
325
|
+
"create_retrying_chat_client",
|
|
326
|
+
"create_upload_plan",
|
|
327
|
+
"create_chat_link_retrieval_plan",
|
|
328
|
+
"decode_card_action_state",
|
|
329
|
+
"default_drive_export_mime_type",
|
|
330
|
+
"encode_card_action_state",
|
|
331
|
+
"evaluate_attachment_policy",
|
|
332
|
+
"explain_chat_capability",
|
|
333
|
+
"explain_google_chat_error",
|
|
334
|
+
"generate_client_message_id",
|
|
335
|
+
"generate_request_id",
|
|
336
|
+
"guard_duplicate_event_delivery",
|
|
337
|
+
"hash_bytes",
|
|
338
|
+
"lint_card_payload",
|
|
339
|
+
"hydrate_placeholder_response_handle",
|
|
340
|
+
"feedback_rating_to_emoji",
|
|
341
|
+
"is_replay_safe",
|
|
342
|
+
"json_response",
|
|
343
|
+
"normalize_action",
|
|
344
|
+
"normalize_agent_response",
|
|
345
|
+
"normalize_attachment",
|
|
346
|
+
"normalize_attachments",
|
|
347
|
+
"normalize_attachments_from_message",
|
|
348
|
+
"normalize_event",
|
|
349
|
+
"normalize_message",
|
|
350
|
+
"plan_attachment_pipeline",
|
|
351
|
+
"parse_pubsub_pull_payload",
|
|
352
|
+
"parse_attachment_content",
|
|
353
|
+
"parse_retry_after_ms",
|
|
354
|
+
"parse_pubsub_push_payload",
|
|
355
|
+
"parse_workspace_chat_resource_event",
|
|
356
|
+
"InMemoryAsyncResponseQueue",
|
|
357
|
+
"plan_async_response",
|
|
358
|
+
"plan_buffered_placeholder_completion",
|
|
359
|
+
"plan_add_reaction",
|
|
360
|
+
"plan_agent_response_message",
|
|
361
|
+
"plan_chat_ingestion",
|
|
362
|
+
"plan_delete_app_message",
|
|
363
|
+
"plan_delete_reaction",
|
|
364
|
+
"plan_buffered_stream_message",
|
|
365
|
+
"plan_chat_permission",
|
|
366
|
+
"plan_complete_placeholder_response",
|
|
367
|
+
"plan_edit_message",
|
|
368
|
+
"plan_feedback_reaction",
|
|
369
|
+
"plan_find_or_setup_dm",
|
|
370
|
+
"plan_list_reactions",
|
|
371
|
+
"plan_placeholder_response",
|
|
372
|
+
"plan_read_space_context",
|
|
373
|
+
"plan_read_thread_context",
|
|
374
|
+
"plan_reply_in_thread",
|
|
375
|
+
"plan_reply_to_event",
|
|
376
|
+
"plan_send_to_space",
|
|
377
|
+
"plan_send_to_user",
|
|
378
|
+
"plan_start_thread",
|
|
379
|
+
"plan_stream_message",
|
|
380
|
+
"resolve_reply_target",
|
|
381
|
+
"push_card",
|
|
382
|
+
"process_polling_ingestion_page",
|
|
383
|
+
"read_card_action_state",
|
|
384
|
+
"render_card_action_note",
|
|
385
|
+
"request_json_with_retry",
|
|
386
|
+
"render_action_system_notes",
|
|
387
|
+
"render_attachment_context_parts",
|
|
388
|
+
"render_ai_context",
|
|
389
|
+
"render_identity_system_note",
|
|
390
|
+
"resolve_human_identity",
|
|
391
|
+
"route_card_action",
|
|
392
|
+
"select_placeholder_text",
|
|
393
|
+
"summarize_card_action",
|
|
394
|
+
"summarize_cards",
|
|
395
|
+
"summarize_transcription_evidence",
|
|
396
|
+
"sanitize_filename",
|
|
397
|
+
"sync_directory_users_to_cache",
|
|
398
|
+
"transcribe_audio",
|
|
399
|
+
"translate_card_payload",
|
|
400
|
+
"update_card",
|
|
401
|
+
"validate_card_message",
|
|
402
|
+
"with_card_action_state",
|
|
403
|
+
]
|