arcade-google-slides 1.0.0__py3-none-any.whl → 1.3.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.
- arcade_google_slides/tools/__init__.py +2 -0
- arcade_google_slides/tools/system_context.py +37 -0
- arcade_google_slides/who_am_i_util.py +81 -0
- {arcade_google_slides-1.0.0.dist-info → arcade_google_slides-1.3.1.dist-info}/METADATA +6 -6
- {arcade_google_slides-1.0.0.dist-info → arcade_google_slides-1.3.1.dist-info}/RECORD +7 -5
- {arcade_google_slides-1.0.0.dist-info → arcade_google_slides-1.3.1.dist-info}/WHEEL +0 -0
- {arcade_google_slides-1.0.0.dist-info → arcade_google_slides-1.3.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -8,6 +8,7 @@ from arcade_google_slides.tools.get import get_presentation_as_markdown
|
|
|
8
8
|
from arcade_google_slides.tools.search import (
|
|
9
9
|
search_presentations,
|
|
10
10
|
)
|
|
11
|
+
from arcade_google_slides.tools.system_context import who_am_i
|
|
11
12
|
|
|
12
13
|
__all__ = [
|
|
13
14
|
"create_presentation",
|
|
@@ -17,4 +18,5 @@ __all__ = [
|
|
|
17
18
|
"comment_on_presentation",
|
|
18
19
|
"list_presentation_comments",
|
|
19
20
|
"generate_google_file_picker_url",
|
|
21
|
+
"who_am_i",
|
|
20
22
|
]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from typing import Annotated, Any
|
|
2
|
+
|
|
3
|
+
from arcade_tdk import ToolContext, tool
|
|
4
|
+
from arcade_tdk.auth import Google
|
|
5
|
+
|
|
6
|
+
from arcade_google_slides.utils import build_slides_service
|
|
7
|
+
from arcade_google_slides.who_am_i_util import build_who_am_i_response
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@tool(
|
|
11
|
+
requires_auth=Google(
|
|
12
|
+
scopes=[
|
|
13
|
+
"https://www.googleapis.com/auth/drive.file",
|
|
14
|
+
"https://www.googleapis.com/auth/userinfo.profile",
|
|
15
|
+
"https://www.googleapis.com/auth/userinfo.email",
|
|
16
|
+
]
|
|
17
|
+
)
|
|
18
|
+
)
|
|
19
|
+
async def who_am_i(
|
|
20
|
+
context: ToolContext,
|
|
21
|
+
) -> Annotated[
|
|
22
|
+
dict[str, Any],
|
|
23
|
+
"Get comprehensive user profile and Google Slides environment information.",
|
|
24
|
+
]:
|
|
25
|
+
"""
|
|
26
|
+
Get comprehensive user profile and Google Slides environment information.
|
|
27
|
+
|
|
28
|
+
This tool provides detailed information about the authenticated user including
|
|
29
|
+
their name, email, profile picture, Google Slides access permissions, and other
|
|
30
|
+
important profile details from Google services.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
auth_token = context.get_auth_token_or_empty()
|
|
34
|
+
slides_service = build_slides_service(auth_token)
|
|
35
|
+
user_info = build_who_am_i_response(context, slides_service)
|
|
36
|
+
|
|
37
|
+
return dict(user_info)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from typing import Any, TypedDict, cast
|
|
2
|
+
|
|
3
|
+
from google.oauth2.credentials import Credentials
|
|
4
|
+
from googleapiclient.discovery import build
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class WhoAmIResponse(TypedDict, total=False):
|
|
8
|
+
my_email_address: str
|
|
9
|
+
display_name: str
|
|
10
|
+
given_name: str
|
|
11
|
+
family_name: str
|
|
12
|
+
formatted_name: str
|
|
13
|
+
profile_picture_url: str
|
|
14
|
+
google_slides_access: bool
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def build_who_am_i_response(context: Any, slides_service: Any) -> WhoAmIResponse:
|
|
18
|
+
"""Build complete who_am_i response from Google Slides and People APIs."""
|
|
19
|
+
credentials = Credentials(
|
|
20
|
+
context.authorization.token if context.authorization and context.authorization.token else ""
|
|
21
|
+
)
|
|
22
|
+
people_service = _build_people_service(credentials)
|
|
23
|
+
person = _get_people_api_data(people_service)
|
|
24
|
+
|
|
25
|
+
user_info = _extract_profile_data(person)
|
|
26
|
+
user_info.update(_extract_google_slides_info(slides_service))
|
|
27
|
+
|
|
28
|
+
return cast(WhoAmIResponse, user_info)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _extract_profile_data(person: dict[str, Any]) -> dict[str, Any]:
|
|
32
|
+
"""Extract user profile data from People API response."""
|
|
33
|
+
profile_data = {}
|
|
34
|
+
|
|
35
|
+
names = person.get("names", [])
|
|
36
|
+
if names:
|
|
37
|
+
primary_name = names[0]
|
|
38
|
+
profile_data.update({
|
|
39
|
+
"display_name": primary_name.get("displayName"),
|
|
40
|
+
"given_name": primary_name.get("givenName"),
|
|
41
|
+
"family_name": primary_name.get("familyName"),
|
|
42
|
+
"formatted_name": primary_name.get("displayNameLastFirst"),
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
photos = person.get("photos", [])
|
|
46
|
+
if photos:
|
|
47
|
+
profile_data["profile_picture_url"] = photos[0].get("url")
|
|
48
|
+
|
|
49
|
+
email_addresses = person.get("emailAddresses", [])
|
|
50
|
+
if email_addresses:
|
|
51
|
+
primary_emails = [
|
|
52
|
+
email for email in email_addresses if email.get("metadata", {}).get("primary")
|
|
53
|
+
]
|
|
54
|
+
if primary_emails:
|
|
55
|
+
profile_data["my_email_address"] = primary_emails[0].get("value")
|
|
56
|
+
|
|
57
|
+
return profile_data
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _extract_google_slides_info(slides_service: Any) -> dict[str, Any]:
|
|
61
|
+
"""Extract minimal Google Slides access information."""
|
|
62
|
+
slides_info: dict[str, Any] = {}
|
|
63
|
+
try:
|
|
64
|
+
slides_info["google_slides_access"] = True
|
|
65
|
+
except Exception:
|
|
66
|
+
slides_info["google_slides_access"] = False
|
|
67
|
+
return slides_info
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _build_people_service(credentials: Credentials) -> Any:
|
|
71
|
+
"""Build and return the People API service client."""
|
|
72
|
+
return build("people", "v1", credentials=credentials)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _get_people_api_data(people_service: Any) -> dict[str, Any]:
|
|
76
|
+
"""Get user profile information from People API."""
|
|
77
|
+
person_fields = "names,emailAddresses,photos"
|
|
78
|
+
return cast(
|
|
79
|
+
dict[str, Any],
|
|
80
|
+
people_service.people().get(resourceName="people/me", personFields=person_fields).execute(),
|
|
81
|
+
)
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arcade_google_slides
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.1
|
|
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
|
|
7
7
|
License-File: LICENSE
|
|
8
8
|
Requires-Python: >=3.10
|
|
9
|
-
Requires-Dist: arcade-ai>=2.1
|
|
10
|
-
Requires-Dist: arcade-serve>=2.
|
|
11
|
-
Requires-Dist: arcade-tdk<3.0.0,>=2.
|
|
9
|
+
Requires-Dist: arcade-ai>=2.2.1
|
|
10
|
+
Requires-Dist: arcade-serve>=2.1.0
|
|
11
|
+
Requires-Dist: arcade-tdk<3.0.0,>=2.3.1
|
|
12
12
|
Requires-Dist: google-api-core<3.0.0,>=2.19.1
|
|
13
13
|
Requires-Dist: google-api-python-client<3.0.0,>=2.137.0
|
|
14
14
|
Requires-Dist: google-auth-httplib2<1.0.0,>=0.2.0
|
|
15
15
|
Requires-Dist: google-auth<3.0.0,>=2.32.0
|
|
16
16
|
Requires-Dist: googleapis-common-protos<2.0.0,>=1.63.2
|
|
17
17
|
Provides-Extra: dev
|
|
18
|
-
Requires-Dist: arcade-ai[evals]<3.0.0,>=2.
|
|
19
|
-
Requires-Dist: arcade-serve<3.0.0,>=2.
|
|
18
|
+
Requires-Dist: arcade-ai[evals]<3.0.0,>=2.2.1; extra == 'dev'
|
|
19
|
+
Requires-Dist: arcade-serve<3.0.0,>=2.1.0; extra == 'dev'
|
|
20
20
|
Requires-Dist: mypy<1.6.0,>=1.5.1; extra == 'dev'
|
|
21
21
|
Requires-Dist: pre-commit<3.5.0,>=3.4.0; extra == 'dev'
|
|
22
22
|
Requires-Dist: pytest-asyncio<0.25.0,>=0.24.0; extra == 'dev'
|
|
@@ -3,13 +3,15 @@ arcade_google_slides/converters.py,sha256=kKxTeuQX_Q4-QpZWCCKteAMAZ0o2McpaWimxg-
|
|
|
3
3
|
arcade_google_slides/enum.py,sha256=uRBfvSfDpbZaunuA6upPP3GvXArOW8r7k6YYPsa9X9M,5289
|
|
4
4
|
arcade_google_slides/types.py,sha256=osCGae3PXl9U_eA7zqVEA6kcju6W-npXLUlsbJZIuqc,6664
|
|
5
5
|
arcade_google_slides/utils.py,sha256=OA0B7jsD6zn3B6Mpil1uSnv9t0XBqtuOXSBbn9SQ034,5125
|
|
6
|
-
arcade_google_slides/
|
|
6
|
+
arcade_google_slides/who_am_i_util.py,sha256=qXckkm6YDe51yy4pm3pqQQy3gyhTKNavr55sJxGrYxg,2734
|
|
7
|
+
arcade_google_slides/tools/__init__.py,sha256=Ki-7TlKY8dbmrhOcYN6Yw5NHypTAHToJcZzpdxVqRhk,732
|
|
7
8
|
arcade_google_slides/tools/comment.py,sha256=SCLONR43ZXBHjLFkaNnIbWvxO3qV0tG-li8HkHi1Npk,2960
|
|
8
9
|
arcade_google_slides/tools/create.py,sha256=JbKhvZH5jbj7dFXLdUhm9mHDWYChXQZ66BSilersYMA,3955
|
|
9
10
|
arcade_google_slides/tools/file_picker.py,sha256=Dqn-hfMoTsWyHM8QCakVgHr5TKrzL_1Lj-vYHVGtOW4,2342
|
|
10
11
|
arcade_google_slides/tools/get.py,sha256=i3KKR-0ZouwLRapV87_Y4OmTL2cyXA8ACwaj3FM3ALw,1013
|
|
11
12
|
arcade_google_slides/tools/search.py,sha256=6tnLT5xRQfibrcbqdGQcowhjBxhLjaojKHVjN_274uA,4768
|
|
12
|
-
arcade_google_slides
|
|
13
|
-
arcade_google_slides-1.
|
|
14
|
-
arcade_google_slides-1.
|
|
15
|
-
arcade_google_slides-1.
|
|
13
|
+
arcade_google_slides/tools/system_context.py,sha256=bP9pPgxDGAXLIsRftUVHUVpbOcex_X6y6kWvTr3eAdM,1176
|
|
14
|
+
arcade_google_slides-1.3.1.dist-info/METADATA,sha256=HnW-92nfkXAhVjBOB3BnS_PHX0sq7vvFL-IyVSKPsa0,1190
|
|
15
|
+
arcade_google_slides-1.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
arcade_google_slides-1.3.1.dist-info/licenses/LICENSE,sha256=ixeE7aL9b2B-_ZYHTY1vQcJB4NufKeo-LWwKNObGDN0,1960
|
|
17
|
+
arcade_google_slides-1.3.1.dist-info/RECORD,,
|
|
File without changes
|
{arcade_google_slides-1.0.0.dist-info → arcade_google_slides-1.3.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|