Commit graph

178 commits

Author SHA1 Message Date
Renato Byrro
cd1fb648bd
Return media attachments metadata when retrieving X tweets (#191)
Modifies X tweet tools to return metadata about media attachments
(photo, GIF or video) when retrieving a tweet by ID, username or
keywords.

The tool will always return media attachments by default. Since it's
only metadata, it shouldn't add significant network overhead to existing
implementations of the tool.

My guess is more often than not people will want this info included.
When not needed, it doesn't hurt to include by default. It'd be annoying
to have to ask the LLM to include it every time they need.
2025-01-08 16:36:43 -03:00
Eric Gustin
b2bdfe2459
Least Privileged Scope for Update Calendar (#195) 2025-01-08 10:03:04 -08:00
Eric Gustin
d5067af023
Bump toolkit versions (#194) 2025-01-07 13:32:36 -08:00
Eric Gustin
feb83c95ca
Pin poetry to 1.8.5 (#193)
# PR Description
Poetry released v2 with many breaking changes a couple days ago. The
`install-poetry` action that our workflows use default to that v2
version, so many of our workflows are failing. This PR forces that
action to use poetry version 1.8.5 and also uses 1.8.5 for toolkits

A ticket to migrate to 2.0.0 has been filed for future work
2025-01-07 13:21:55 -08:00
Nate Barbettini
fd5b429322
Rename inputs -> input to match Engine (#190)
Tool definitions in the Engine were missing `input` because the field
was renamed.

---------

Co-authored-by: Eric Gustin <eric@arcade-ai.com>
2025-01-03 17:42:58 -08:00
Eric Gustin
890ee96ef4
Rename actor to worker (#174)
# PR Description
This PR renames `actor` to `worker` 

**Does not include deployment related things in
`.github/workflows/release-containers.yml`**
2025-01-03 14:28:04 -08:00
Sterling Dreyer
2cc9aba0f4
Fix For New Schemas (#187)
This is a start but may be incomplete

---------

Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2025-01-03 13:47:23 -08:00
Nate Barbettini
179837f7fb
CLI quality of life improvements (#189)
Small QOL improvements: graceful messages in error situations
2025-01-03 13:47:11 -08:00
Eric Gustin
f7f5888b21
Stricter jinja version (#186)
# PR Description
Jinja2 versions 3.1.5 or higher resolves security vulnerabilities in
this repo.
2025-01-02 14:09:22 -08:00
Eric Gustin
0ad8dc6e5e
Link to Engine installation documentation (#184)
# PR Description:
If someone tries to run `arcade dev` without the Engine installed they
get the following:


![image](https://github.com/user-attachments/assets/bc4063bb-3fb1-471c-a9bc-77f73a660308)
2024-12-24 10:19:58 -08:00
Eric Gustin
ab889f9f1d
Lint all toolkits (#183)
# PR Description
* Adds/updates the following files to all toolkits:
    - `.pre-commit-config.yaml`
    - `.ruff.toml`
    - `LICENSE`
    - `Makefile`
    - `pyproject.toml`
* Lint all toolkits such that they pass `make check` and `make test` (a
total doozy). This includes adding some unit tests and evals.
* Github workflow for testing toolkits before merge into main (courtesy
of @sdreyer)
* Added a QOL improvement for tool developers for when they need to get
the context's auth token.
* Minor updates to `arcade new` template.
2024-12-20 09:49:45 -08:00
Sterling Dreyer
950a8600f8
Remove lock flag from check (#181) 2024-12-19 11:36:32 -08:00
Sterling Dreyer
1512d0699e
Testing for Math Toolkit (#180) 2024-12-19 11:28:03 -08:00
Sterling Dreyer
70faf7af5a
Test Version Override (#179)
Testing to make sure pypi versions don't override. This should fail
2024-12-19 11:13:18 -08:00
Sterling Dreyer
d46accee2f
Fix Dispatch Repo Name (#178) 2024-12-19 10:44:00 -08:00
Eric Gustin
7c228a59d5
Update Evals SDK (#175)
# PR Description
This PR renames `ExpectedToolCall` to `NamedExpectedToolCall` and then
creates a new dataclass called `ExpectedToolCall`. `ExpectedToolCall`
can be passed to the `EvalSuite.add_case` and `EvalSuite.extend_case`
methods.

1. Enhance `EvalSuite.add_case` and `EvalSuite.extend_case` by accepting
a list of `ExpectedToolCall` as their `expected_tool_calls` input
parameter. This helps create a scaffolding for developers. Previously,
the expected type was `list[tuple[Callable, dict[str, Any]]]`, which is
still valid for backward compatibility.
```python
# Before (still valid for backward compatibility)
expected_tool_calls=[
    (
        adjust_playback_position,
        {
            "absolute_position_ms": 10000,
        },
    )
]
        

# After
expected_tool_calls=[
    ExpectedToolCall(
        func=adjust_playback_position,
        args={"absolute_position_ms": 10000},
    )
]
```
2. Removed any references to arcade.core in toolkits directory.
3. Some linting for import organization.
2024-12-19 10:29:13 -08:00
Eric Gustin
a4b58d9749
Fix /show for Cloud Engine (#177)
# PR Description
### The following bug was observed: 
* When connected to the cloud engine for `arcade chat`, and the user
types `/show`, then the local environment tools are displayed. Instead,
the cloud engine's tools should be displayed.

### Why was this bug happening?:
* When a user entered the `/show` command, the CLI Command `show` was
being called directly. Since the function was a CLI command, the `local`
parameter was not being processed and resolved to its intended value
because the Typer CLI interface was being bypassed. So, the conditional
`if local:` would always evaluate to `True`.

### How this was fixed:
* I created a wrapper function for the `show` CLI Command. Now, when the
user types `/show`, then the wrapper function is called instead of the
`show` CLI command. This ensures that all input parameters are resolved
to their intended values.
2024-12-19 10:13:58 -08:00
Sterling Dreyer
f8c8d47a01
Release Toolkits Individually (#176) 2024-12-18 16:34:06 -08:00
Eric Gustin
b12ceec4b5
arcade evals Default to localhost (#172)
# PR Description
* `arcade evals` now run evaluations against Arcade Engine at
`http://localhost:9099` by default.
* Added optional flag `--cloud` to run evaluations against Arcade's
Cloud Engine at `https://api.arcade-ai.com`. Overrides `-h` flag.
* Always print the Engine that the evaluations are using. Previously
this was reserved for `-d` flag.
2024-12-17 10:41:32 -08:00
Eric Gustin
d8c8b060af
Update arcade chat Help Menu (#170)
# PR Description
* Fixes available commands display bug
* Add `/history` command. Displays the conversation history.


```
Available Commands:
  /show         Show all available tools
  /history      Show the chat history
  /clear        Clear the chat history
  /exit         Exit the chat
  /?, /help     Help for a command

Surround in """ for multi-line messages
```
2024-12-16 18:32:03 -08:00
Eric Gustin
02eee63884
X Toolkit: Support tweets longer than 280 characters (#171)
# PR Description
* Update `search_recent_tweets_by_username`,
`search_recent_tweets_by_keywords`, and `lookup_tweet_by_id` to support
long tweets. Previously, only the first 280 characters of the tweet's
text were returned by the tool.
2024-12-13 09:04:50 -08:00
Eric Gustin
00d5babcd7
Add next_token to X Search tools (#169)
# PR Description
Adds an optional `next_token` input parameter to the
`X.SearchRecentTweetsByUsername` and `X.SearchRecentTweetsByKeywords`
tools.

This allows users to paginate through tweets. A `next_token` is provided
in the tools's response.

For example, to access the `next_token` when using the `tools.execute`,
you can do `next_token = response.output.value["meta"].get("next_token",
None)` and then pass it to the tool on your next call through the tools'
`next_token` input parameter.
2024-12-10 12:35:20 -08:00
Nate Barbettini
0344bc79cb
Bump arcadepy dependency (#168)
`arcadepy` is now at [0.2.1 on
pypi](https://pypi.org/project/arcadepy/0.2.1/).
The SDK references `arcadepy` but it is locked to the `0.1.x` minor
release.
2024-12-03 07:18:18 -08:00
Eric Gustin
8dbbe23d73
Add arcade new Improvements (#156)
# PR Description
This PR is a part of the community contributed toolkits story.

* `arcade new` now uses jinja templates
* `arcade new` now creates a "cookiecutter" toolkit equipped with
everything a community contributed toolkit needs to be easily tested,
published to PyPi, etc. as its own Github repo
* I created the following toolkit with `arcade new`:
- [PyPi](https://pypi.org/project/arcade-local-file-management/0.1.5/)
-
[Github](https://github.com/EricGustin/local_file_management/tree/0.1.5)
2024-12-02 17:44:09 -08:00
Sam Partee
bebfcab1e9
Add lookup_tweet_by_id to X Toolkit (#165)
This PR introduces the `lookup_tweet_by_id` tool to the X toolkit,
enabling users to retrieve tweet details by tweet ID. This enhancement
extends the toolkit's capabilities, allowing for more comprehensive
interactions with the X (Twitter) API.

**Key Changes:**

- **Added `lookup_tweet_by_id` Tool:**
- Implemented the `lookup_tweet_by_id` function in `tools/tweets.py`,
which allows users to fetch tweet information using a tweet ID.
- Included error handling for API response codes and expanded URLs in
tweets to assist language models in avoiding hallucinations due to
shortened URLs.

- **Enhanced Toolkit Structure:**
- Added several configuration files to the X toolkit to establish a
standardized project structure, which in the future will be generated by
`arcade new`. These include:
- `.pre-commit-config.yaml`: Defines pre-commit hooks for code quality
checks.
    - `.ruff.toml`: Configuration for the Ruff linter.
    - `LICENSE`: MIT License file for the toolkit.
- `Makefile`: Contains common commands for building, testing, and
linting the toolkit.

- **Updated Makefile:**
- Added `make check-toolkits` command to the top-level `Makefile`. This
command runs code quality tools for each toolkit that contains a
`Makefile`.

**Additional Notes:**

- **Tests:**
- Added unit tests for the new `lookup_tweet_by_id` tool in
`tests/test_tweets.py`.
- Included tests for the user lookup functionality in
`tests/test_users.py`.

- **Linting and Code Quality:**
- Configured pre-commit hooks and Ruff linter to enforce code standards.
- Updated the `pyproject.toml` file with development dependencies for
testing and linting.

-

---------

Co-authored-by: Eric Gustin <eric@arcade-ai.com>
2024-11-27 17:07:12 -08:00
Wils Dawson
cf6a2969bf
Add Atlassian as a supported provider. (#167) 2024-11-27 11:44:03 -08:00
Wils Dawson
a094ed7fc0
Add Dropbox as an auth provider. (#164)
Related to: CU-86b2dtdj2
2024-11-27 11:04:39 -08:00
Wils Dawson
466ea933cd
Support Discord as an Auth provider (#161)
This supports Discord as an auth provider. It depends on the next
release of the Arcade Engine to work, so ~we'll hold off on merging for
now.~ we'll do it live!
2024-11-22 15:43:44 -08:00
Nate Barbettini
6ca856bd4f
Update extensions.json (#160)
Update `extensions.json` with all of the extensions we use as a team for
this specific repo.
2024-11-20 12:24:56 -08:00
Eric Gustin
2798cc0820
Add Gmail Thread Tools (#159)
# PR Description
1. This PR adds three new tools:
    - GetThread (by ID)
    - ListThreads
    - SearchThreads
2. This PR updates the return type for various Gmail tools from str to
dict.
3. This PR adds evals and tests for the added tools
2024-11-20 11:26:09 -08:00
Eric Gustin
82afd7ec70
Update starlette dep via bumping FastAPI (#158)
Patches vulnerability that is due to starlette version < 0.40.0 by
bumping the fastAPI version to 0.115.3

FastAPI 0.115.3 release notes:
https://github.com/fastapi/fastapi/releases/tag/0.115.3
2024-11-19 09:17:28 -08:00
Eric Gustin
8b46e4f7f9
Add Code Sandbox Tools (#114)
# PR Description
This PR creates a new toolkit called CodeSandbox. This toolkit has two
tools:
1. `RunCode`: Creates an E2B sandbox and runs the provided code in that
sandbox. Returns the execution logs, result, and errors. Supports
Python, JavaScript, R, Java, and Bash code.
2. `CreateStaticMatplotlibChart`: Creates a sandbox, runs the provided
python code that uses matplotlib, and returns the base64 encoded image
of the chart along with any logs or errors.
- I recommend not using `tool_choice="generate"` since the return object
contains a base64 image can be a lot of tokens that will not provide
much value to a generate's response.
    
    
    
Example of creating a pie chart:
```python
import base64
import json
import os

from openai import OpenAI


def call_tool_with_openai(client: OpenAI) -> dict:
    response = client.chat.completions.create(
        messages=[
            {
                "role": "user",
                "content": "There are 17 red apples, 4 green apples, and 10 yellow apples. Create a pie chart for this data.",
            },
        ],
        model="gpt-4o-mini",
        user="you@example.com",
        tools=["CodeSandbox.CreateStaticMatplotlibChart"],
        tool_choice="execute",
    )

    return response


arcade_api_key = os.environ.get("ARCADE_API_KEY")
cloud_host = "http://localhost:9099/v1"

openai_client = OpenAI(
    api_key=arcade_api_key,
    base_url=cloud_host,
)

chat_result = call_tool_with_openai(openai_client)
tool_call_id = chat_result.choices[0].message.tool_calls[0].id

content = json.loads(chat_result.choices[0].message.content)
base64_image = content[tool_call_id]["value"]["base64_image"]

image_data = base64.b64decode(base64_image)
with open("output_image.png", "wb") as image_file:
    image_file.write(image_data)

```
2024-11-15 13:29:52 -08:00
Eric Gustin
f757e01d42
Create README for PyPi (#154)
# PR Description
The `arcade/pyproject.toml` wasn't able to find the `README.md` file
because it must be a subpath of `arcade-ai/arcade`. I created a simple
README for PyPi
2024-11-13 12:37:34 -08:00
Eric Gustin
1da1231e5b
Add readme and description to PyPi Project Page (#153)
# PR Description
Currently the [Arcade AI PyPi Page](https://pypi.org/project/arcade-ai/)
doesn't have a description. This PR adds that.
2024-11-13 11:00:44 -08:00
Eric Gustin
026d518c6e
Add multi-line chat and help menu (#152)
# PR Description
Given that `arcade chat` is the entry point for all users, this PR makes
the developer's first experience with Arcade a better experience.

1. Add multi-line & pasting support to `arcade chat`. To start a
multi-line chat message, start your message with `"""`. To end the
multi-line chat message, end your line with `"""`.

![image](https://github.com/user-attachments/assets/f190f487-d8d6-4c1d-ab73-29e811528d16)

2. Added chat commands
  - `/?` displays all available chat commands that are available
- `/show` shows all of the tools available. This uses `arcade show`.
Currently no option to specify the toolkit, or tool.
  - `/clear` clears the chat conversation history of the current session
  - `/exit` exits the chat. (ctrl+c still works of course!)
  

![image](https://github.com/user-attachments/assets/265b9977-5621-441a-9b80-5f33f5be5681)
2024-11-13 10:32:20 -08:00
Eric Gustin
c02aee3f14
CLI Improvements (#151)
1. Fixes bug where arcade login doesn't work for localhost
- `arcade login -h localhost` will open login page at
`http://localhost:8000/...`
    - Optionally specify the port: `arcade login -h localhost -p 8000`


3. Adds `local` flag to `arcade show`
- `-h localhost`, `-h 127.0.0.1`, and `-h 0.0.0.0` shows the tools that
are in the local engine's catalog
    - `--local` show the tools that are in the local environment.
2024-11-06 16:25:45 -08:00
Eric Gustin
081865733a
Add examples (#136)
## PR Description
This PR adds 7 examples.

* `call_a_tool_directly_with_auth.py` - Simple example that uses Arcade
client to execute a tool that lists Gmail emails
* `call_a_tool_directly.py` - Simple example that uses Arcade client to
execute a tool that adds two numbers together
* `call_a_tool_with_llm.py` - Simple example that uses the LLM api to
star the arcade-ai repository
* `get_auth_token.py` - Simple example that gets a Google auth token and
then calls the Google API
* `call_multiple_tools_directly_with_auth.py` - A more involved example
that directly calls multiple spotify tools sequentially
* `call_multiple_tools_with_llm.py` - A more involved example that uses
an llm to call multiple spotify tools sequentially
* `simple_chatbot.py` - Simple chatbot that uses arcade tools and has
history

---------

Co-authored-by: Nate Barbettini <nathanaelb@gmail.com>
2024-11-06 11:02:41 -08:00
Eric Gustin
6d1bc6c084
Random int and random float tools (#148)
As requested by D&D fans
2024-11-06 09:28:05 -08:00
Eric Gustin
311bfaa26f
Minor QOL improvement for arcade chat (#149) 2024-11-06 09:13:21 -08:00
Nate Barbettini
29ccf19e73
fix: arcade dev waits forever if no toolkits are installed (#147)
Fixes an edge case where the actor doesn't start because no toolkits are
installed in the local environment, but `arcade dev` keeps waiting for a
healthy actor.
2024-11-05 13:37:39 -08:00
Eric Gustin
bc393db305
Return success message if playback is altered (#145)
# PR Description
Previously, if a tool adjusted the playback state, then the tool would
return the current playback state after the modification had occurred.
The problem with this approach was that Spotify would not update the
playback state in time (sometimes), so the tools were returning stale
data!
2024-11-04 17:22:10 -08:00
Nate Barbettini
39d342bd67
fix: Wait for healthy actor in arcade dev (#142)
Context: Currently, `arcade dev` starts the actor process and then waits
a hardcoded amount of time (2sec) for the actor to start up. This isn't
enough time on some slower machines, which leads to the engine trying to
start but failing.

Fix: Wait until the actor is healthy according to its own
`/actor/health` endpoint.
2024-11-04 09:39:09 -08:00
Eric Gustin
8dbfed5c52
Fix log that stated the number of tools found in toolkit (#144)
The original log was counting the number of files in the toolkit module.
This PR fixes this such that it counts the number of tools in the
toolkit.
2024-11-04 09:27:43 -08:00
Eric Gustin
b22e3198a7
Update README.md (#141) 2024-11-04 09:27:30 -08:00
Nate Barbettini
1fdf982238
fix: No output from arcade login when already logged in (#143)
I ran into this and was scratching my head why `arcade login` was
exiting with no output.

Fix: Get config data from the new top-level object we introduced.
2024-11-01 16:49:31 -07:00
Nate Barbettini
aff7350eec
fix: readline error on Windows (#139)
With this change, `pyreadline3` is automatically installed on OS `win32`
only. Linux/Mac doesn't need it.
2024-11-01 13:15:52 -07:00
Eric Gustin
efee9589fa
More Spotify Tools (#140)
# PR Description
This PR adds three new spotify tools that are natural language friendly.

1. `search` - Search Spotify Catalog information
2. `play_artist_by_name` - Gets 5 songs by the specified artist and
plays them. Uses `search`, and `start_tracks_playback_by_id` under the
hood
3. `play_track_by_name` - Plays the specified song, optionally provide
the artist name who plays the song. Uses `search`, and
`start_tracks_playback_by_id` under the hood
2024-11-01 13:15:43 -07:00
Nate Barbettini
8b29407d2d
fix: runtime error when OTEL is not enabled (#138)
Symptom: If an `otel_meter` wasnot passed when constructing the actor
(which is allowed, it's an optional param), the actor would later crash
at runtime.

Fix: Always set `tool_counter` to a default value.
2024-11-01 12:38:54 -07:00
Nate Barbettini
3699b16b2d
fix: circular import in arcade.core (#137)
Fixes a circular import issue where `arcade.sdk -> arcade.core` but also
`arcade.core -> arcade.sdk`. My mistake!

Moved some of the shared classes down into `core`, and re-exported them
to `sdk` to keep the expected interface for devs.
2024-11-01 12:38:44 -07:00
Eric Gustin
c8e686c04e
Add tools to Spotify Toolkit (#132)
# PR Description
1. `adjust_playback_position` - Adjust the playback position within the
currently playing track
2. `skip_to_previous_track` - Skip to the previous track in the user's
queue, if any
3. `skip_to_next_track` - Skip to the next track in the user's queue, if
any
4. `pause_playback` - Pause the currently playing track, if any
5. `resume_playback` - Resume the currently playing track, if any
6. `start_tracks_playback_by_id` - Start playback of a list of tracks
(songs)
7. `get_playback_state` - Get information about the user's current
playback state, including track or episode, and active device
8. `get_currently_playing` - Get information about the user's currently
playing track
9. `get_track_from_id` - Get information about a track
10. `get_recommendations` - Get track (song) recommendations based on
seed artists, genres, and tracks, and multiple target audio stats
11. `get_tracks_audio_features` - Get audio features for a list of
tracks (songs)
----------------------

My favorite feature of this toolkit is
1. Start playing my favorite song
2. Get the song that I'm currently playing
3. Get audio features of that song
4. Ask for recommended songs that are similar to it
5. Jam out

------------
2024-10-30 18:26:39 -07:00