arcade-google-slides 0.1.1__py3-none-any.whl → 1.0.0__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.
@@ -2,6 +2,7 @@ from arcade_google_slides.tools import (
2
2
  comment_on_presentation,
3
3
  create_presentation,
4
4
  create_slide,
5
+ generate_google_file_picker_url,
5
6
  get_presentation_as_markdown,
6
7
  list_presentation_comments,
7
8
  search_presentations,
@@ -14,4 +15,5 @@ __all__ = [
14
15
  "search_presentations",
15
16
  "comment_on_presentation",
16
17
  "list_presentation_comments",
18
+ "generate_google_file_picker_url",
17
19
  ]
@@ -3,6 +3,7 @@ from arcade_google_slides.tools.comment import (
3
3
  list_presentation_comments,
4
4
  )
5
5
  from arcade_google_slides.tools.create import create_presentation, create_slide
6
+ from arcade_google_slides.tools.file_picker import generate_google_file_picker_url
6
7
  from arcade_google_slides.tools.get import get_presentation_as_markdown
7
8
  from arcade_google_slides.tools.search import (
8
9
  search_presentations,
@@ -15,4 +16,5 @@ __all__ = [
15
16
  "search_presentations",
16
17
  "comment_on_presentation",
17
18
  "list_presentation_comments",
19
+ "generate_google_file_picker_url",
18
20
  ]
@@ -1,14 +1,22 @@
1
1
  import base64
2
2
  import json
3
+ from typing import Annotated
3
4
 
4
- from arcade_tdk import ToolContext, ToolMetadataKey
5
+ from arcade_tdk import ToolContext, ToolMetadataKey, tool
6
+ from arcade_tdk.auth import Google
5
7
  from arcade_tdk.errors import ToolExecutionError
6
8
 
7
9
 
8
- def generate_google_file_picker_url(context: ToolContext) -> dict:
10
+ @tool(
11
+ requires_auth=Google(),
12
+ requires_metadata=[ToolMetadataKey.CLIENT_ID, ToolMetadataKey.COORDINATOR_URL],
13
+ )
14
+ def generate_google_file_picker_url(
15
+ context: ToolContext,
16
+ ) -> Annotated[dict, "Google File Picker URL for user file selection and permission granting"]:
9
17
  """Generate a Google File Picker URL for user-driven file selection and authorization.
10
18
 
11
- Generates a URL that directs the end-user to a Google File Picker interface where
19
+ This tool generates a URL that directs the end-user to a Google File Picker interface where
12
20
  where they can select or upload Google Drive files. Users can grant permission to access their
13
21
  Drive files, providing a secure and authorized way to interact with their files.
14
22
 
@@ -17,8 +25,8 @@ def generate_google_file_picker_url(context: ToolContext) -> dict:
17
25
  (Requested entity was not found) or permission errors. Once the user completes the file
18
26
  picker flow, the prior tool can be retried.
19
27
 
20
- Returns:
21
- A dictionary containing the URL and instructions for the llm to instruct the user.
28
+ Suggest this tool to users when they are surprised or confused that the file they are
29
+ searching for or attempting to access cannot be found.
22
30
  """
23
31
  client_id = context.get_metadata(ToolMetadataKey.CLIENT_ID)
24
32
  client_id_parts = client_id.split("-")
@@ -44,6 +52,6 @@ def generate_google_file_picker_url(context: ToolContext) -> dict:
44
52
  "url": url,
45
53
  "llm_instructions": (
46
54
  "Instruct the user to click the following link to open the Google Drive File Picker. "
47
- f"This will allow them to select files and grant access permissions: {url}"
55
+ "This will allow them to select files and grant access permissions: {url}"
48
56
  ),
49
57
  }
@@ -1,9 +1,8 @@
1
1
  from typing import Annotated, cast
2
2
 
3
- from arcade_tdk import ToolContext, ToolMetadataKey, tool
3
+ from arcade_tdk import ToolContext, tool
4
4
  from arcade_tdk.auth import Google
5
5
 
6
- from arcade_google_slides.decorators import with_filepicker_fallback
7
6
  from arcade_google_slides.types import Presentation
8
7
  from arcade_google_slides.utils import build_slides_service, convert_presentation_to_markdown
9
8
 
@@ -14,9 +13,7 @@ from arcade_google_slides.utils import build_slides_service, convert_presentatio
14
13
  "https://www.googleapis.com/auth/drive.file",
15
14
  ],
16
15
  ),
17
- requires_metadata=[ToolMetadataKey.CLIENT_ID, ToolMetadataKey.COORDINATOR_URL],
18
16
  )
19
- @with_filepicker_fallback
20
17
  async def get_presentation_as_markdown(
21
18
  context: ToolContext,
22
19
  presentation_id: Annotated[str, "The ID of the presentation to retrieve."],
@@ -1,11 +1,9 @@
1
1
  from typing import Annotated, Any
2
2
 
3
- from arcade_tdk import ToolContext, ToolMetadataKey, tool
3
+ from arcade_tdk import ToolContext, tool
4
4
  from arcade_tdk.auth import Google
5
5
 
6
6
  from arcade_google_slides.enum import OrderBy
7
- from arcade_google_slides.file_picker import generate_google_file_picker_url
8
- from arcade_google_slides.templates import optional_file_picker_instructions_template
9
7
  from arcade_google_slides.utils import (
10
8
  build_drive_service,
11
9
  build_files_list_params,
@@ -20,7 +18,6 @@ from arcade_google_slides.utils import (
20
18
  requires_auth=Google(
21
19
  scopes=["https://www.googleapis.com/auth/drive.file"],
22
20
  ),
23
- requires_metadata=[ToolMetadataKey.CLIENT_ID, ToolMetadataKey.COORDINATOR_URL],
24
21
  )
25
22
  async def search_presentations(
26
23
  context: ToolContext,
@@ -112,19 +109,9 @@ async def search_presentations(
112
109
  if not pagination_token or len(batch) < page_size:
113
110
  break
114
111
 
115
- file_picker_response = generate_google_file_picker_url(
116
- context,
117
- )
118
-
119
112
  return {
120
113
  "presentations_count": len(files),
121
114
  "presentations": files,
122
- "file_picker": {
123
- "url": file_picker_response["url"],
124
- "llm_instructions": optional_file_picker_instructions_template.format(
125
- url=file_picker_response["url"]
126
- ),
127
- },
128
115
  "llm_instructions": (
129
116
  "If the results were not satisfactory, then inform the user that "
130
117
  "you can also search across all of their shared drives."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arcade_google_slides
3
- Version: 0.1.1
3
+ Version: 1.0.0
4
4
  Summary: Arcade.dev LLM tools for Google Slides
5
5
  Author-email: Arcade <dev@arcade.dev>
6
6
  License: Proprietary - Arcade Software License Agreement v1.0
@@ -0,0 +1,15 @@
1
+ arcade_google_slides/__init__.py,sha256=lDbDi5794U-ao476aHyqlymoVBwJAyG938e3TXV4A0c,474
2
+ arcade_google_slides/converters.py,sha256=kKxTeuQX_Q4-QpZWCCKteAMAZ0o2McpaWimxg-6IxHI,9870
3
+ arcade_google_slides/enum.py,sha256=uRBfvSfDpbZaunuA6upPP3GvXArOW8r7k6YYPsa9X9M,5289
4
+ arcade_google_slides/types.py,sha256=osCGae3PXl9U_eA7zqVEA6kcju6W-npXLUlsbJZIuqc,6664
5
+ arcade_google_slides/utils.py,sha256=OA0B7jsD6zn3B6Mpil1uSnv9t0XBqtuOXSBbn9SQ034,5125
6
+ arcade_google_slides/tools/__init__.py,sha256=h35BQ0jxKERBbo-BpNCPJnAksiLO3o9hvpV2NAtBjw8,653
7
+ arcade_google_slides/tools/comment.py,sha256=SCLONR43ZXBHjLFkaNnIbWvxO3qV0tG-li8HkHi1Npk,2960
8
+ arcade_google_slides/tools/create.py,sha256=JbKhvZH5jbj7dFXLdUhm9mHDWYChXQZ66BSilersYMA,3955
9
+ arcade_google_slides/tools/file_picker.py,sha256=Dqn-hfMoTsWyHM8QCakVgHr5TKrzL_1Lj-vYHVGtOW4,2342
10
+ arcade_google_slides/tools/get.py,sha256=i3KKR-0ZouwLRapV87_Y4OmTL2cyXA8ACwaj3FM3ALw,1013
11
+ arcade_google_slides/tools/search.py,sha256=6tnLT5xRQfibrcbqdGQcowhjBxhLjaojKHVjN_274uA,4768
12
+ arcade_google_slides-1.0.0.dist-info/METADATA,sha256=_IzTbF8W7_KIH75KBT1BLASpkDSDVYGjn6n9q477Nok,1190
13
+ arcade_google_slides-1.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ arcade_google_slides-1.0.0.dist-info/licenses/LICENSE,sha256=ixeE7aL9b2B-_ZYHTY1vQcJB4NufKeo-LWwKNObGDN0,1960
15
+ arcade_google_slides-1.0.0.dist-info/RECORD,,
@@ -1,24 +0,0 @@
1
- import functools
2
- from collections.abc import Callable
3
- from typing import Any
4
-
5
- from arcade_tdk import ToolContext
6
- from googleapiclient.errors import HttpError
7
-
8
- from arcade_google_slides.file_picker import generate_google_file_picker_url
9
-
10
-
11
- def with_filepicker_fallback(func: Callable[..., Any]) -> Callable[..., Any]:
12
- """ """
13
-
14
- @functools.wraps(func)
15
- async def async_wrapper(context: ToolContext, *args: Any, **kwargs: Any) -> Any:
16
- try:
17
- return await func(context, *args, **kwargs)
18
- except HttpError as e:
19
- if e.status_code in [403, 404]:
20
- file_picker_response = generate_google_file_picker_url(context)
21
- return file_picker_response
22
- raise
23
-
24
- return async_wrapper
@@ -1,5 +0,0 @@
1
- optional_file_picker_instructions_template = (
2
- "Ensure the user knows that they have the option to select and grant access permissions to "
3
- "additional documents via the Google Drive File Picker. "
4
- "The user can pick additional documents via the following link: {url}"
5
- )
@@ -1,17 +0,0 @@
1
- arcade_google_slides/__init__.py,sha256=NJk6XPdTtpKDTdDYxzP_rOVqTxjdfSF0yQVde1KliV0,398
2
- arcade_google_slides/converters.py,sha256=kKxTeuQX_Q4-QpZWCCKteAMAZ0o2McpaWimxg-6IxHI,9870
3
- arcade_google_slides/decorators.py,sha256=SQeS2_fa3UOgUgGiYuY5eugguIyRPvHVc85TSracSZY,753
4
- arcade_google_slides/enum.py,sha256=uRBfvSfDpbZaunuA6upPP3GvXArOW8r7k6YYPsa9X9M,5289
5
- arcade_google_slides/file_picker.py,sha256=kGfUVfH5QVlIW1sL-_gAwPokt7TwVEcPk3Vnk53GKUE,2005
6
- arcade_google_slides/templates.py,sha256=pxbdMj57eV3-ImW3CixDWscpVKS94Z8nTNyTxDhUfGY,283
7
- arcade_google_slides/types.py,sha256=osCGae3PXl9U_eA7zqVEA6kcju6W-npXLUlsbJZIuqc,6664
8
- arcade_google_slides/utils.py,sha256=OA0B7jsD6zn3B6Mpil1uSnv9t0XBqtuOXSBbn9SQ034,5125
9
- arcade_google_slides/tools/__init__.py,sha256=JMWqB_57Nul0mF6vwSJsqzHp91cimmy9cvqcgM-tacw,531
10
- arcade_google_slides/tools/comment.py,sha256=SCLONR43ZXBHjLFkaNnIbWvxO3qV0tG-li8HkHi1Npk,2960
11
- arcade_google_slides/tools/create.py,sha256=JbKhvZH5jbj7dFXLdUhm9mHDWYChXQZ66BSilersYMA,3955
12
- arcade_google_slides/tools/get.py,sha256=ZqV8gtDJR0I7wMugholR59zCtHfT5CjiaG3kwl9XCZk,1209
13
- arcade_google_slides/tools/search.py,sha256=IG75QZWwWvBvi0widULJQJdheX2XfYpkSxol5u_9tT0,5346
14
- arcade_google_slides-0.1.1.dist-info/METADATA,sha256=UJBsiT22Pf8FmbuNjMt72vJfa5WbYQA-80OMDd5A2xk,1190
15
- arcade_google_slides-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- arcade_google_slides-0.1.1.dist-info/licenses/LICENSE,sha256=ixeE7aL9b2B-_ZYHTY1vQcJB4NufKeo-LWwKNObGDN0,1960
17
- arcade_google_slides-0.1.1.dist-info/RECORD,,