Commit graph

138 commits

Author SHA1 Message Date
Sterling Dreyer
eed4c0181b
Arcade Serve (#274)
Co-authored-by: Sam Partee <sam@arcade-ai.com>
2025-03-07 18:40:26 -08:00
Eric Gustin
16db170b2c
Update arcade new (#266)
* New README
2025-03-07 18:38:14 -08:00
Eric Gustin
4608cce862
Fix parameterized type bug & better error message (#273)
## PR Description
### 1. Bug Fix
A bug was observed where tools that were using [parameterized
generics](https://docs.python.org/3/library/stdtypes.html#types-genericalias)
(e.g., `dict[str, Any]`) for their input parameters or output, then this
would cause the Worker to fail on startup with the error `issubclass()
arg 1 must be a class` for Python3.13+. This error would not occur for
Python versions less than 3.13.

In Python <3.13, parameterized generics would implicitly be treated as
their underlying type (its origin), so it was possible to treat
`dict[str, Any]` as a class and pass it to `issubclass`. This is not the
case for Python 3.13, so we need to explicitly strip the GenericAlias
(e.g., `dict[str, Any]`) down to its origin (e.g., `dict`), before
checking if it is a subclass of `Enum`.

### 2. Better Error Message
When a tool used an unsupported parameter/output type, then Arcade would
display the following message:
```
Failed to start Arcade Worker: 
Type error encountered while adding tool get_website_map from arcade_web.tools.firecrawl. 
Reason: issubclass() arg 1 must be a class
```

But now it displays
```
Failed to start Arcade Worker: 
Error encountered while adding tool get_website_map from arcade_web.tools.firecrawl. 
Reason: Unsupported type: tuple[str, str]
```
2025-03-07 11:46:42 -08:00
Eric Gustin
fb69e9ef77
Add Notion Auth Provider (#277)
<img width="409" alt="Screenshot 2025-03-06 at 11 01 24 AM"
src="https://github.com/user-attachments/assets/27cb160e-c8cc-4107-a455-aa1ee9b392c4"
/>
2025-03-06 16:06:52 -08:00
Nate Barbettini
3638038ddf
fix: Package version in pyproject.toml is wrong (#276)
Package [1.0.5](https://pypi.org/project/arcade-ai/1.0.5/) is currently
the latest on pypi. The version number in pyproject.toml got out of
sync.

The next release should be 1.1.0 to take into account these minor
version changes that _should_ have bumped the version:
- https://github.com/ArcadeAI/arcade-ai/pull/243
- https://github.com/ArcadeAI/arcade-ai/pull/252
2025-03-05 16:15:23 -08:00
Nate Barbettini
4a0e2b8667
fix: Tool secret keys must use a case-insensitive comparison (#275)
Missed one test case here.
2025-03-04 14:33:55 -08:00
Nate Barbettini
3f7226709f
feat: Tool secrets (#252)
SDK support for tool secrets (stored and managed by the engine):
- [x] New `requires_secrets=` option in the `@tool` decorator
- [x] Internal plumbing in the catalog and `ToolContext`
- [x] Full test coverage of all added code
- [x] Bumped minor version (new feature)

This PR can be merged without waiting for Engine changes, because it is
additive only (no breaking changes).

After this is merged, I will open another PR to update existing toolkits
that will benefit from this feature!
2025-02-27 15:56:11 -08:00
Nate Barbettini
7466543bde
fix: add missing --model option (#270)
Fixes an inconsistency in `arcade chat --help`.

Before:
<img width="590" alt="image"
src="https://github.com/user-attachments/assets/bf643e3c-ee12-421a-8cd3-e0d322c0972a"
/>

After:
<img width="588" alt="image"
src="https://github.com/user-attachments/assets/c0a40cdf-3429-468c-9bf1-9e3710907796"
/>
2025-02-27 15:45:47 -08:00
Eric Gustin
e636b686c1
Add @tool.deprecated (#247)
## PR Description
Add the ability to mark a tool as deprecated and display the warning in
the user's runtime. This PR also lays the foundation for future work for
emitting other levels of logs (debug, info, etc) that occur during the
tool's execution.

NOTE: Updates to the Arcade Clients (Python and JS) still need to be
done before the deprecation warning is emitted, but this PR needs to be
merged before those updates!

Let's cross our fingers that we'll never need to deprecate
`@tool.deprecated`!

### Example

1. Mark your tool as deprecated
```python
from typing import Annotated

from arcade.sdk import tool


@tool.deprecated("Use the 'Math.AddInt' tool instead.") # order of decorators does not matter
@tool
def add(
    a: Annotated[int, "The first number"], b: Annotated[int, "The second number"]
) -> Annotated[int, "The sum of the two numbers"]:
"""
Add two numbers together
"""
return a + b
```

2. Call the deprecated tool
```python
from arcadepy import Arcade

client = Arcade()

tool_input = {"a": 9001, "b": 42}

response = client.tools.execute(
    tool_name="Math.Add",
    input=tool_input,
    user_id="me@example.com",
)
print(f"The result of adding {tool_input['a']} and {tool_input['b']} is: {response.output.value}")
```

3. Observe the DeprecationWarning:
``` 
❯ python examples/call_a_tool_directly.py 
/Users/ericgustin/repos/Team/arcade-ai/examples/call_a_tool_directly.py:22: DeprecationWarning: 'Math.Add' is deprecated: Use the `Math.AddInt` tool instead.
  response = client.tools.execute(
The result of adding 9001 and 42 is: 9043
```
2025-02-18 13:27:49 -08:00
Eric Gustin
3870e84108
Workerup doesnt need to be logged in (#255) 2025-02-18 11:11:15 -08:00
Eric Gustin
49ff013e80
[Toolkit Release] Weekly Toolkit Release 02-13-25 (#248)
# Weekly Toolkit Release 02-13-25
Previous Toolkit Release: #236 

## Associated PRs
* Minor #241
2025-02-13 13:06:11 -08:00
Nate Barbettini
cb5cb7b730
fix: use correct UTF-8 encoding on Windows in arcade new (#246)
Fixes the linked issue. Tested on Windows 10
2025-02-12 14:50:46 -08:00
Eric Gustin
19086818d2
Make fastapi a regular dependency (#243)
## PR Description
Changes `pip install 'arcade-ai[fastapi]'` to `pip install arcade-ai`. 
In other words, FastAPI is now a required dependecy of arcade-ai.


Additionally, I snuck in some minor cleanup changes.
2025-02-10 15:30:51 -08:00
Eric Gustin
df969d9d73
Improve Arcade CLI (#244) 2025-02-08 10:56:04 -08:00
Eric Gustin
be2539602f
Evals New Features (#208)
# PR Description
This PR adds ~~four~~ three improvements to evals.

~~## 1. Add parameterized eval cases~~
~~Adds a new method named `add_parameterized_case`. Just like pytest’s
parameterized tests, eval cases can be parameterized with multiple user
messages. Adds a case to the `EvalSuite` for each user message. All
cases have the same expected tool call(s), params, additional_messages.
This reduces duplicate code and makes it easy to observe how a model
performs based on increasingly more difficult prompts.~~
```python
""" NO LONGER IN THIS PR
user_messages = [
    "Call the delete tweet by id tool with the tweet ID '148975632'.",
    "Delete the tweet with ID '148975632'.",
    "I don't want to have this tweet (148975632) on my account anymore.",
    "do the opposite of post for https://x.com/x/status/148975632",
]

suite.add_parameterized_case(
    name="Delete a tweet by ID",
    user_messages=user_messages,
    expected_tool_calls=[
        ExpectedToolCall(
            func=delete_tweet_by_id,
            args={"tweet_id": "148975632"},
        )
    ],
    critics=[
        BinaryCritic(
            critic_field="tweet_id",
            weight=1.0,
        ),
    ],
)
"""
```

~~PASSED Delete a tweet by ID (user_message 1 of 4) -- Score: 100.00%~~
~~PASSED Delete a tweet by ID (user_message 2 of 4) -- Score: 100.00%~~
~~PASSED Delete a tweet by ID (user_message 3 of 4) -- Score: 100.00%~~
~~FAILED Delete a tweet by ID (user_message 4 of 4) -- Score: 0.00%~~
~~Summary -- Total: 4 -- Passed: 3 -- Failed: 1~~

## 2. Parameters that are not explicitly criticized are assigned a
`NoneCritic`.
A NoneCritic has no effect on the evaluation results and does not
actually evaluate. Parameters that have a NoneCritic will be displayed
as ‘un-criticized’ in the evaluation summary (if `-d` flag is used).

![image](https://github.com/user-attachments/assets/300756ec-9b53-436a-9cf9-fc61d0b00c01)


## 3. Add a hardcoded `seed` parameter for evals.
The seed parameter aides in receiving (mostly) consistent outputs -
aiding in reproducibility for evaluations.

## 4. Disallow more than one critic for the same field.
Raises a `ValueError` if more than one critic is assigned to a field.

---------

Co-authored-by: Eric Gustin <eric@arcade-ai.com>
2025-02-05 15:22:08 -08:00
Nate Barbettini
9d49572f09
Update CDN URL to cdn.arcade.dev (#238)
Updates our public CDN URL.
2025-01-30 11:58:41 -08:00
Eric Gustin
a344cc0a8b
Use cross platform paths (#237)
# PR Description
Tiny PR to use `os.path.join` instead of hardcoding paths with forward
slashes.
2025-01-30 09:51:57 -08:00
Eric Gustin
ce2fb0f6c1
Update Examples & Various Renames (#233)
# PR Description
* This PR updates code in `examples/` to be compatible with version
1.0.0
* This PR removes the Spotify examples since the Arcade hosted worker
doesn't currently cataloge the Spotify toolkit. We can reintroduce these
examples when it does.
* This PR performs various renames across the codebase for
`arcade-ai.com` --> `arcade.dev` and `Arcade AI` --> `Arcade`
2025-01-28 17:17:29 -08:00
Nate Barbettini
a1db8a9f33
Fix login URL (fixes CSRF issues) (#225)
The CLI was starting the login process on the old domain, which is why
we were seeing a CSRF error. The cookie was placed on `arcade-ai.com`
not `arcade.dev`!
2025-01-23 22:44:57 -08:00
Eric Gustin
4c95b7bebb
arcade-ai Version 1.0.0 (#224) 2025-01-23 19:28:35 -08:00
Eric Gustin
6fb45c8797
Use AuthorizationResponse and ToolDefinition (#221) 2025-01-23 18:32:00 -08:00
Sterling Dreyer
130858a958
Ignore Toolkits (#219) 2025-01-23 15:37:15 -08:00
Eric Gustin
1bd8eac6ed
Add Ability to Disable Tools (#215)
# PR Description
This PR introduces a new environment variable `ARCADE_DISABLED_TOOLS`.
Tools that are added to this env var are not added to the worker's
`ToolCatalog`. In effect, they are disabled for the worker.

## How to use the `ARCADE_DISABLED_TOOLS` environment variable
* Each tool is separated by a comma.
* For each tool, specify the toolkit name in camel case and the tool
name in camel case.
* Do not include versions. (This is a simple implementation. We can add
disabling specific versions in the future if needed)
* Separate the toolkit name and the tool name with your environment's
tool name separator. By default, the tool name separator is `.`, but you
can override this with the `ARCADE_TOOL_NAME_SEPARATOR` environment
variable.

Correct: `export
ARCADE_DISABLED_TOOLS="Math.Add,Spotify.GetAvailableDevices,Math.Sqrt"`
Incorrect: `export
ARCADE_DISABLED_TOOLS="Math.Add@0.1.0,Spotify.get_available_devices,Sqrt`
2025-01-21 15:56:40 -08:00
Eric Gustin
7a7f37e5fc
Add arcade --version (#211)
# PR Description
Implements a version callback for the arcade CLI.

### Usage
`arcade --version` OR `arcade -v`

### Example Output
`Arcade (version 0.1.5)`
2025-01-17 15:48:36 -08:00
Eric Gustin
6035cde920
Update auth provider_id (#173)
# PR Description
Well known providers (Google, X, Dropbox, etc.) can optionally have an
`id` in addition to their hardcoded `provider_id`. For non well known
providers, they must provide an `id`, and the `provider_id` is hardcoded
as `None`.

```python
OAuth2() # INVALID
OAuth2(provider_id="abc") # INVALID
OAuth2(id="abc") # VALID
OAuth2(provider_id="abc", id="def") # INVALID
```
```python
Google() # VALID
Google(provider_id="abc") # INVALID
Google(id="abc") # VALID
Google(provider_id="abc", id="def") # INVALID
```

---------

Co-authored-by: Wils Dawson <wils@arcade-ai.com>
2025-01-17 11:38:06 -08:00
Eric Gustin
cdd90b4844
Remove toml (#210)
# PR Description
`arcade.toml` was deprecated in favor of `credentials.yaml` in PR #116 .
This PR completely removes any references to handling the deprecation &
any references to `arcade.toml`
2025-01-17 09:56:43 -08:00
Eric Gustin
3f9da98560
Updates for arcadepy1.0.0rc Compatibility (#209)
# PR Description
arcadepy version 1.0.0rc renamed `AuthorizationResponse` to
`AuthAuthorizationResponse`
2025-01-17 09:26:11 -08:00
Eric Gustin
5022d339a2
Update arcade new template to pass linting (#201) 2025-01-14 08:32:38 -08:00
Eric Gustin
22f2422aff
Add progress bar to Evals CLI (#185)
Adds a progress bar to the arcade evals CLI command. Displays progress
on the number of `@tool_eval` functions that have completed.
2025-01-08 22:40:45 -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
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
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
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
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
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