Commit graph

150 commits

Author SHA1 Message Date
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
Eric Gustin
ddaeb4db53
Add list stargazers tool (#130)
# PR Description
As a celebration for arcade-ai becoming open sourced, this PR adds a
tool to list the stargazers for a particular repository


### Example `arcade chat -h localhost` usage:

![image](https://github.com/user-attachments/assets/c4ba9ce6-d3ec-461b-b356-72e78a09249b)
2024-10-30 18:13:36 -07:00
Eric Gustin
d91d14aee4
Update issue templates (#134) 2024-10-30 17:44:22 -07:00
Eric Gustin
2e9ac89e94
Add Issue Templates (#133)
# Description
* Add an issue template for bug reports
* Add an issue template for feature requests
2024-10-30 17:16:58 -07:00
Sam Partee
65a3b74fea
Langgraph update (#131) 2024-10-28 17:08:24 -07:00
Eric Gustin
a66cffbcc4
Update README.md (#129) 2024-10-28 10:56:47 -07:00
Sam Partee
7f4280853c
Update Langgraph studio Example (#128) 2024-10-28 09:51:02 -07:00
Sam Partee
275a3d63b9
Update README (#127) 2024-10-25 20:14:30 -07:00
Nate Barbettini
75b9ea8e91
Bump arcadepy version (#126)
Use the latest version of `arcadepy` to pull in bug fixes and added
helper methods
2024-10-25 17:04:04 -07:00
Sam Partee
4d2786935a
Langchain arcade (#125)
Co-authored-by: Eric Gustin <eric@arcade-ai.com>
Co-authored-by: Nate Barbettini <nathanaelb@gmail.com>
Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2024-10-25 16:59:21 -07:00
Eric Gustin
5b64404839
Update README.md (#124)
Update the README so that it has useful content and looks nice.
2024-10-24 18:43:16 -07:00
Nate Barbettini
036ad54ac6
Remove arcade.core from all examples (#121)
This PR ensures that `arcade.core` does not show up anywhere in "user
space". This is crucial for helping developers understand what objects
are safe to use, and helps maintain a good developer experience.

Specific changes:
- `ToolAuthorizationContext` and `ToolContext` are now visible via
`arcade.sdk`
- `ToolCatalog` is now visible via `arcade.sdk`
- `Toolkit` is now visible via `arcade.sdk`
- `config` is now visible via `arcade.sdk.config`
2024-10-24 17:08:04 -07:00
Eric Gustin
c528b2c7dc
Add pyyaml dependency (#123) 2024-10-24 14:33:53 -07:00
Sterling Dreyer
fc26339d29
Modified Default Env Template (#122) 2024-10-24 12:34:13 -07:00
Eric Gustin
8508a28f54
Config Refactor (#116)
# PR Description
1. Removes `arcade config` CLI command and it's helper function.
2. Upon `arcade login`, if the user does not have an `arcade.env` file,
then a templated environment file is created for the user.
3. Removed `EngineConfig` and all references to it. Since there is no
longer an `EngineConfig`, this PR refactors the CLI to compute the
engine URL based on the command-line flags that were provided.
4. Renamed `arcade.toml` to `credentials.yaml`. If a user is using
`arcade.toml`, then we will display a deprecation message and then
automatically migrate their `arcade.toml` to `credentials.yaml`. NOTE:
Eventually this auto-migration support should be removed.
5. `arcade.env` is now an optional file
6. Make `arcade show` default to `https://api.arcade-ai.com/v1` instead
of localhost.
-------




## Ensuring engine url is still computed correctly:
I used the following matrix to ensure that the behavior has not changed
after the refactor. This matrix is tested in `test_utils.py`

DEFAULT_HOST = "api.arcade-ai.com"  
DEFAULT_PORT = None  
DEFAULT_FORCE_TLS = False  
DEFAULT_FORCE_NO_TLS = False  


| Command Line Arguments | Host | Port | Force TLS | Force No TLS |
Main's URL | This PR's URL |

|----------------------------------------|-----------------|---------------|-----------|--------------|-----------------------------------|-----------------------------------|
| | DEFAULT_HOST | DEFAULT_PORT | False | False |
https://api.arcade-ai.com/v1 | https://api.arcade-ai.com/v1 |
| --host localhost | localhost | DEFAULT_PORT | False | False |
http://localhost:9099/v1 | http://localhost:9099/v1 |
| -p 9099 | DEFAULT_HOST | 9099 | False | False |
https://api.arcade-ai.com:9099/v1 | https://api.arcade-ai.com:9099/v1 |
| --host localhost -p 9099 | localhost | 9099 | False | False |
http://localhost:9099/v1 | http://localhost:9099/v1 |
| --tls | DEFAULT_HOST | DEFAULT_PORT | True | False |
https://api.arcade-ai.com/v1 | https://api.arcade-ai.com/v1 |
| --host localhost --tls | localhost | DEFAULT_PORT | True | False |
https://localhost:9099/v1 | https://localhost:9099/v1 |
| -p 9099 --tls | DEFAULT_HOST | 9099 | True | False |
https://api.arcade-ai.com:9099/v1 | https://api.arcade-ai.com:9099/v1 |
| --host localhost -p 9099 --tls | localhost | 9099 | True | False |
https://localhost:9099/v1 | https://localhost:9099/v1 |
| --no-tls | DEFAULT_HOST | DEFAULT_PORT | False | True |
http://api.arcade-ai.com/v1 | http://api.arcade-ai.com/v1 |
| --host localhost --no-tls | localhost | DEFAULT_PORT | False | True |
http://localhost:9099/v1 | http://localhost:9099/v1 |
| -p 9099 --no-tls | DEFAULT_HOST | 9099 | False | True |
http://api.arcade-ai.com:9099/v1 | http://api.arcade-ai.com:9099/v1 |
| --host localhost -p 9099 --no-tls | localhost | 9099 | False | True |
http://localhost:9099/v1 | http://localhost:9099/v1 |
| --tls --no-tls | DEFAULT_HOST | DEFAULT_PORT | True | True |
http://api.arcade-ai.com/v1 | http://api.arcade-ai.com/v1 |
| --host localhost --tls --no-tls | localhost | DEFAULT_PORT | True |
True | http://localhost:9099/v1 | http://localhost:9099/v1 |
| -p 9099 --tls --no-tls | DEFAULT_HOST | 9099 | True | True |
http://api.arcade-ai.com:9099/v1 | http://api.arcade-ai.com:9099/v1 |
| --host localhost -p 9099 --tls --no-tls| localhost | 9099 | True |
True | http://localhost:9099/v1 | http://localhost:9099/v1 |
| --host arandomhost.com | arandomhost.com | DEFAULT_PORT | False |
False | https://arandomhost.com/v1 | https://arandomhost.com/v1 |
2024-10-24 11:34:33 -07:00
Nate Barbettini
10030c6a12
Fix iteration when calling client.tools.list (#120)
**Blocked** until this is merged **and** Stainless clients are re-built:
https://github.com/ArcadeAI/Engine/pull/148
TODO: Update arcadepy version dependency.
2024-10-24 09:39:20 -07:00
Eric Gustin
ce0616a471
Fix issues in arcade show (#117)
# PR Description
1. `arcade show` only supported lowercase args for toolkit and tools.
This PR allows the user to use capitalization and the tool/toolkit will
still be displayed.
2. `arcade show -T` is now for showing a toolkit and `arcade show -t` is
now for showing a tool.
2024-10-23 15:33:19 -07:00
Sterling Dreyer
80b7d968ff
Search for etc paths (#118)
Depends on: https://github.com/ArcadeAI/arcade-ai/pull/116
2024-10-23 15:31:37 -07:00
Nate Barbettini
9d00295e33
Replace arcade.client with arcadepy (#119)
Closes: https://app.clickup.com/t/86b2k2962

---------

Co-authored-by: sdreyer <sterling@arcade-ai.com>
2024-10-23 15:29:02 -07:00
Eric Gustin
fd8190e216
Update arcade version in web toolkit toml (#113)
When #110 was merged the build failed with:
```
9.372 Installing toolkit ./toolkits/arcade_web-2024.10.17.dev0-py3-none-any.whl
9.687 Processing ./toolkits/arcade_web-2024.10.17.dev0-py3-none-any.whl
9.749 Collecting firecrawl-py<2.0.0,>=1.3.1
9.872   Downloading firecrawl_py-1.3.1-py3-none-any.whl (15 kB)
9.911 ERROR: Could not find a version that satisfies the requirement arcade-ai<0.2.0,>=0.1.0 (from arcade-web) (from versions: 0.0.1, 0.0.13)
9.911 ERROR: No matching distribution found for arcade-ai<0.2.0,>=0.1.0
```

and I believe this fixes the issue
2024-10-17 16:36:29 -07:00
Eric Gustin
cc2a08ec34
Add Firecrawl Tools For The New arcade_web` Toolkit (#110)
# PR Description
This PR adds 6 new tools inside the new `arcade_web` toolkit. None of
these tools require auth. They do, however, require the
`FIRECRAWL_API_KEY` API Key to be set.

The new tools implement the [Firecrawl](https://www.firecrawl.dev/) APIs
`/scrape (POST)`, `/crawl (POST)`, `/crawl/{id} (GET)`, `/crawl/{id}
(DELETE)`, and `/map (POST)`.

The six tools are:
* `Web.ScrapeUrl`: 
- In the future I would like this tool to support actions (clicking,
scrolling, screenshotting, etc) and extract (specify what you want to
scrape) parameters. Firecrawl supports both of these parameters.
* `Web.CrawlWebsite`:
- If `async_crawl` is true, then the tool just returns the id of the
crawl job, which you can retrieve later with the `Web.GetCrawlData`
tool. If `async_crawl` is false, then the entire contents of the crawl
are returned.
* `Web.GetCrawlStatus`
- Works for in progress or recently finished crawl jobs (Firecrawl's
limitation)
* `Web.GetCrawlData`
- Works for in progress or recently finished crawl jobs (Firecrawl's
limitation)
* `Web.CancelCrawl`
    - You can cancel an in progress async crawl job
* `Web.MapWebsite`
- This endpoint is in alpha, but it can give you all of the links of an
entire website, or optionally, you can specify in natural language what
type of links you want to map by using the `search` parameter. For
example "only map webpages that are about AI"
2024-10-17 16:10:53 -07:00
Nate Barbettini
1c6e3f4495
arcade chat: Auto open browser for auth links (#112)
Fixes two points of feedback:
- In terminals that don't support links, we need to print the whole URL
as a backup
- Just open the browser dammit! -- Wils

### Demo


https://github.com/user-attachments/assets/91ced5ef-43d3-45a4-8af7-beb1a7bcde8d
2024-10-17 15:18:26 -07:00
Sam Partee
8a1114ab62
Fix arcade-ai versions in arcade new cmd` (#111)
fix for version:
Dynamic Version Retrieval: Replaces the hardcoded version import with
dynamic retrieval using importlib.metadata.version. This ensures that
__version__ in __init__.py accurately reflects the installed version of
arcade-ai.

fix to ``arcade-new``: Changes the default dependency specification for
arcade-ai from ^{VERSION} to ~{VERSION} in DEFAULT_VERSIONS in
``new.py``. This adjustment allows for patch version updates while
maintaining compatibility, enhancing stability.

---------

Co-authored-by: Eric Gustin <eric@arcade-ai.com>
2024-10-17 13:51:16 -07:00
Nate Barbettini
c81da86460
Fix nits in CLI (#108)
Fixes:
- [Opening browser doesn't work in
ssh](https://app.clickup.com/t/86b2h46f7)
- ["bright black" color text in `arcade chat -d` is invisible in
iTerm](https://app.clickup.com/t/86b2h494v)
- [Colors and styles are inconsistent in non-zsh
shells](https://app.clickup.com/t/86b2h49kb)
2024-10-15 18:13:44 -07:00
sdreyer
0c63110d66 Revert "Fixed versioning syntax in makefile (#106)"
This reverts commit b88a07b526.
2024-10-14 20:42:10 -07:00
Sterling Dreyer
b95e26e5ec
Fix missing type packages (#107) 2024-10-14 20:38:27 -07:00
Sterling Dreyer
b88a07b526
Fixed versioning syntax in makefile (#106) 2024-10-14 10:07:53 -07:00
Eric Gustin
74a47f1062
Improve arcade new (#104)
# PR Description
This PR improves the CLI command `arcade new` in multiple ways.
1. When prompting the developer if they want to create a test/evals
folder, the default was printed twice. This is now fixed.
2. Whether to generate a test/eval directory, the user must enter "yes".
This PR relaxes this to accept other variations.
3. Creates an eval suite instead of an empty folder.
4. Prevents a developer from overwriting an existing toolkit.
2024-10-11 16:22:10 -07:00
Sam Partee
ff092ac303
Remove client.chat resource (#105)
This was always temporary, but we are finally removing the chat resource
from the ``Arcade`` and ``AsyncArcade`` clients.
2024-10-10 18:03:30 -07:00