Commit graph

85 commits

Author SHA1 Message Date
Nate Barbettini
799d376ae5
SDK: Generic OAuth 2.0 connector (#81)
- Implements https://app.clickup.com/t/86b1whxb3 on the SDK side
- - Corresponding Engine PR:
https://github.com/ArcadeAI/Engine/pull/113/files?w=1
- Updates existing toolkits with new syntax.
2024-10-03 16:40:02 -07:00
Eric Gustin
28ce4d0dfc
Update arcade version for github toolkit (#83) 2024-10-02 10:56:35 -07:00
Sterling Dreyer
e7b937e393
Fix Package Builds (#82) 2024-10-02 10:51:18 -07:00
Eric Gustin
7e352fbe91
Add Github Toolkit (#75)
### Adds the following tools to the Github Toolkit:

    1.	CreateIssueComment
	2.	SetStarred
	3.	CountStargazers
	4.	ListOrgRepositories
	5.	GetRepository
	6.	ListRepositoryActivities
	7.	ListReviewCommentsInARepository
	8.	ListPullRequests
	9.	GetPullRequest
	10.	UpdatePullRequest
	11.	ListPullRequestCommits
	12.	CreateReplyForReviewComment
	13.	ListReviewCommentsOnPullRequest
	14.	CreateReviewComment



Adds evals for all of these tools and unit tests.

---------

Co-authored-by: Sam Partee <sam@arcade-ai.com>
2024-10-02 10:40:17 -07:00
Eric Gustin
bf53439b55
Add Google Calendar Tools (#71)
This PR adds four new tools to the Google ToolKit
* `create_event`
* `list_events`
* `update_event`
* `delete_event`


I also improved an error log when tools are being registered by the
actor.


This PR also sneaks in an eval for gmail


Here is a sample conversation that shows the tools and their
capabilities and limitiations:

![image](https://github.com/user-attachments/assets/a70e97d7-2c4e-4f6e-aebd-1fcaaf6c36b9)
2024-10-02 10:24:11 -07:00
Sam Partee
13563871cb Fix Poetry install order (#80) 2024-10-01 23:48:51 -07:00
Sterling Dreyer
1988053bb0
Change make docker command (#79) 2024-10-01 21:56:52 -07:00
Sam Partee
52d82a2789
Refactor Docker Build Process (#78)
This PR improves the Docker build process by shifting from building the
project within the Docker image to using pre-built wheels. The main
changes are:

1. **Updated Makefile:**
- **`VERSION` Variable:** Set to `0.1.0.dev0` to reflect the new default
development version.
   - **`docker` Target:**
- Added steps to build the Arcade and toolkit wheels before building the
Docker image.
- Exports the required extras (`fastapi`, `evals`) to a
`requirements.txt` file.
   - **`full-dist` Target:**
     - Builds distributions for the main project and all toolkits.
     - Copies all the built wheels to a centralized `./dist` directory.
   - **`clean-dist` Target:**
- Cleans build artifacts from `./dist`, `arcade/dist`, and
`toolkits/*/dist` directories.

2. **Modified Dockerfile:**
- **Copy Pre-built Wheels:** Adjusted to copy wheels and the
`requirements.txt` from the `./dist` directory into the Docker image.
   - **Installation Process:**
     - Installs the Arcade wheel with the necessary extras.
- Installs toolkits from the copied wheel files, eliminating the need to
build them inside the Docker image.
- **Simplification:** Removed unnecessary commands, such as installing
build tools and copying the entire codebase, to streamline the
Dockerfile.

3. **Toolkits `pyproject.toml` Updates:**
- Changed the `arcade-ai` dependency version from `^0.1.0` to `0.1.*` in
all toolkit `pyproject.toml` files to ensure compatibility with the new
versioning scheme.

4. **Docker Makefile Adjustments:**
- Set the `VERSION` variable to `0.1.0.dev0` to align with the main
Makefile.
- Ensures consistent versioning across Docker-related build processes.

**Benefits:**

- **Efficiency:** Building wheels outside the Docker context reduces the
Docker image build time and resource consumption. overall docker image
size reduced by **1Gb**!!!
- **Reliability:** Using pre-built wheels ensures consistency across
different environments and simplifies dependency management.
- **Maintainability:** The Dockerfile and Makefiles are cleaner and more
straightforward, making them easier to understand and maintain.


**Notes:**

- Developers should run `make docker` to build and run the Docker
container using the new process.
- Ensure that any CI/CD pipelines are updated to accommodate these
changes in the build process. @sdreyer
2024-10-01 19:05:13 -07:00
Sam Partee
ef72e6c5aa
Merge of arcade up and dev (#77)
Combination of these PRs:
https://github.com/ArcadeAI/arcade-ai/pull/74
https://github.com/ArcadeAI/arcade-ai/pull/76
2024-10-01 12:44:27 -07:00
Eric Gustin
83cf070c82
Toolkit lint cleanup (#72)
Included toolkits as part of the linting process.

Cleaned up any tools that needed to be updated because of this.

This portion of the PR description was added via arcade chat!
2024-10-01 10:41:38 -07:00
Eric Gustin
aabceae135
Improve ToolOutputError message (#73)
Before this PR error message:

![image](https://github.com/user-attachments/assets/2d36c05e-006a-4fc5-8265-d2371f9142e4)

Updated error message: 

![image](https://github.com/user-attachments/assets/f7ae7a81-f9b2-4471-9c24-8b02c8009065)
2024-09-27 21:40:57 -07:00
Sterling Dreyer
a3a662c6a2
Fixed error when missing phrase or keyword (#70) 2024-09-25 16:18:36 -07:00
Eric Gustin
5a32685b19
arcade chat catch OpenAIErrors (#69)
Instead of `arcade chat` crashing, we just prompt the user again


![image](https://github.com/user-attachments/assets/34aaed14-13af-4ab0-aae2-9734b34cf7ba)
2024-09-25 15:55:35 -07:00
Eric Gustin
9eb9f77a92
Poll for auth completion in arcade chat (#66)
This PR re-organizes arcade chat implementation and also adds polling
for auth response to complete (if any)


### arcade chat streaming with auth:
![Screenshot 2024-09-25 at 11 28
45 AM](https://github.com/user-attachments/assets/c351fce7-060a-4060-b215-6b5d05028216)

### arcade chat without streaming with auth:
![Screenshot 2024-09-25 at 11 33
08 AM](https://github.com/user-attachments/assets/29a6c5ad-857c-47e6-92d9-52ec87ff88c9)

---------

Co-authored-by: Nate Barbettini <nathanaelb@gmail.com>
2024-09-25 13:43:04 -07:00
Nate Barbettini
94f77f26af
full-dist: put toolkits in dist/toolkits/ (#68)
This helps separate the SDK wheel from toolkit wheels, to make
programmatic copying easier
2024-09-25 13:29:50 -07:00
Nate Barbettini
5b9438da82
Gracefully handle toolkit load errors (#67) 2024-09-25 12:46:18 -07:00
Nate Barbettini
894fa878f1
Fix ruff (#64)
On the last few PRs I have noticed two problems:
1. `ruff format` fails even though it seems OK on our local machines
(sometimes, not always)
2. Nate's and Sam's machines kept flip-flopping a specific piece of
formatting back and forth, indicating a subtle difference of config
hiding somewhere
3. This was reproducible by running `ruff format` in the terminal,
followed by `make check`. The former would edit files, and then `make
check` would edit them back!

This PR addresses both issues, and further standardizes our editor &
linter configs to be super stable.
Specifically:
1. The main fix for the above, the pre-commit hook was pinned to a super
old version of ruff.
This resulted in subtle differences in behavior between our machines,
and on CI.

2. Moved ruff settings from `pyproject.toml` to `.ruff.toml`
pyproject files in subdirectories (e.g. `toolkits/**`) were overriding
the main pyproject file and erasing the custom ruff config we set at the
root. This meant that our ruff config was applied to `arcade` but not to
any of the other packages.
By moving the config to `.ruff.toml` at the root, all projects will
inherit the same ruff linting & formatting config.

4. Un-ignored the `.vscode/` directory so that we can share
vscode/cursor workspace settings.
This is valuable for standardizing settings like the default formatter
(ruff) and default test framework (pytest).
However, it's important that going forward we _only_ commit things here
that should apply across all of our machines.

5. To avoid any conflict between prettier and ruff, prettier now
explicitly ignores *.py files

6. Finally, `ruff format` and `make check` agree. A number of files are
newly auto-formatted.
2024-09-25 09:47:30 -07:00
Nate Barbettini
33621a79e4
Generate poetry.lock before caching (#63)
Our Github Actions build cache step is subtly broken. (see comment
below)
2024-09-25 09:46:29 -07:00
Sam Partee
7d9354b4b4
Address alpha release tweaks and bugs (#62)
# Address Alpha Release Tweaks and Bugs

This PR addresses several issues and tweaks identified during the alpha
release:

- **Ensure `~/.arcade` directory exists before writing the config file**
In `arcade/cli/authn.py`, added code to create the `~/.arcade` directory
if it doesn't exist. This prevents errors when writing the configuration
file during the login process.

- **Fix retry logic in process management**  
In `arcade/cli/launcher.py`, corrected an off-by-one error in the retry
logic within the `_manage_processes` function. This ensures that the
process management behaves as expected when retries are exhausted.

- **Allow passing environment variables to the engine process**
(technically this option isn't exposed yet)
Updated the `start_servers`, `_manage_processes`, and `_start_process`
functions in `arcade/cli/launcher.py` to accept an `engine_env`
parameter. This allows custom environment variables to be set for the
engine process. Also, set `GIN_MODE` to `"release"` by default.

- **Handle cases with no critics in evaluations**  
Modified the `EvalCase` class in `arcade/sdk/eval/eval.py` to handle
scenarios where no critics are provided. This avoids potential errors
during the evaluation process when critics are absent. Should add a test
for this.

- **Adjust dependencies in `pyproject.toml`**  
- Moved `uvicorn` to be an optional dependency and included it in the
`fastapi` extra.
- Removed unnecessary development dependencies (`mkdocs`,
`mkdocs-material`, `mkdocstrings`).
  - Ensured that `uvicorn` is updated to version `^0.30.0`.

---------

Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2024-09-25 07:35:25 -07:00
Nate Barbettini
6b7562f6a2
Update dockerfile to install extras on build (#61)
Correctly installs python extras during `docker build` (tested locally)
2024-09-24 18:18:10 -07:00
Nate Barbettini
5cf451802d
Fix extras in pyproject.toml (#58)
Extras were not being installed by pip correctly. Our syntax in
pyproject.toml was incorrect:
https://python-poetry.org/docs/pyproject/#extras

Tested in a new conda environment and working.
2024-09-24 18:02:56 -07:00
Nate Barbettini
9ceb474372
Fix action file path again (#60)
Missed one, gotta catch 'em all
2024-09-24 17:56:33 -07:00
Nate Barbettini
dd572b8cce
Fix action file path (#59)
The path `poetry.lock` is wrong, fixed
2024-09-24 17:50:02 -07:00
Nate Barbettini
06decd44ec
Update arcade up to use arcade-engine (#57)
Fixes the binary name from `engine` to `arcade-engine`
2024-09-24 16:48:08 -07:00
Sam Partee
2eb46a3a98
Client Fixes and LangGraph Examples (#50)
This PR includes several improvements to the Arcade client and adds
LangGraph examples:

1. Enhanced error handling in the Arcade client:
   - Improved HTTP error handling in `BaseArcadeClient`
- Simplified request methods in `SyncArcadeClient` and
`AsyncArcadeClient`

2. Updated `ToolResource` class:
   - Changed base path from `/v1/tool` to `/v1/tools`
   - Added `tool_version` parameter to `authorize` method

3. Improved Toolkit discovery:
- Updated `find_all_arcade_toolkits` to search only in the current
Python interpreter's site-packages

5. Added LangGraph examples:
   - New `langgraph_auth.py` example demonstrating Gmail authentication
- New `langgraph_with_tool_exec.py` example showing tool execution
within a LangGraph

6. Minor updates:
   - Changed default `BASE_URL` to `https://api.arcade.com/`
   - Updated import error message for eval dependencies

---------

Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2024-09-24 10:13:45 -07:00
Eric Gustin
8d66b52512
Fix empty X search result bug (#54)
Before:

![image](https://github.com/user-attachments/assets/4419dee1-bbfb-4fc3-a3bd-882e13f12919)


Now:

![image](https://github.com/user-attachments/assets/00cd1fe6-7766-4d51-a328-af2211b9c1ac)
2024-09-24 09:31:10 -07:00
Nate Barbettini
c1a66a6170
SDK: Fully qualified tool names (#47)
In this PR:
- Handle and require fully-qualified tool names `Toolkit.ToolName` in
the actor

Also, unrelated changes/fixes:
- Cleaned up the logic around actor secrets and `$ARCADE_ACTOR_SECRET`
- Removes experimental Flask actor for now

Note: Must be merged along with
https://github.com/ArcadeAI/Engine/pull/87
2024-09-23 15:47:36 -07:00
Eric Gustin
53fa083efd
Add initial X toolkit, remove Github toolkit, rename math toolkit (#52)
* Renamed `arcade_arithmetic` to `arcade_math`
* Deleted `arcade_github` toolkit for the next release. This will be
reintroduced later.
* Added 5 tools to `arcade_x` toolkit
- post_tweet
- delete_tweet_by_id
- search_recent_tweets_by_username
- search_recent_tweets_by_keywords
- lookup_single_user_by_username
2024-09-23 13:42:22 -07:00
Eric Gustin
18cc192290
Add tool messages to arcade chat conversation history (#49)
* Adds tool calls and tool responses to the conversation history for
streaming and non-streaming.
* Adds debug flag for arcade chat which displays the tool calls and tool
responses that occurred during generate `arcade chat -d`
2024-09-21 10:26:20 -07:00
Sterling Dreyer
399ad5f878
Release python (#48) 2024-09-20 16:42:53 -07:00
Sam Partee
5b7370c3f0
Eval Suite additions (#43)
Merge of #38 as rebase was terrible. @nbarbettini

---------

Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2024-09-19 22:08:39 -07:00
Sterling Dreyer
447058f0ce
Install additional packages in docker (#46) 2024-09-19 12:46:50 -07:00
Sterling Dreyer
6911a5982b
Moved gmail toolkit to google (#44) 2024-09-19 12:11:11 -07:00
Nate Barbettini
739cc957f1
Fix CI: config errors, Python 3.11 union type errors (#45)
Fixes 2 issues that were causing CI to fail:
- Loading `config` in `eval.py` breaks because no API key can be found
in CI
- Python 3.11+ changed `Union` to `UnionType`
2024-09-19 12:07:28 -07:00
Eric Gustin
43198a3a9b
Add New Gmail Tools To The Google Toolkit (#41)
# PR Description

## Summary

Changes include renaming the `arcade_gmail` toolkit to `arcade_google`,
adding unit tests for Google toolkit, add new tools to the Google
toolkit.
## Changes

### Makefile
- Added a new `make test-toolkits` target to iterate over all toolkits
and run pytest on each one.

### Added new tools for the google toolkit

1. `send_email`
This tool sends an email using the Gmail API.

2. `write_draft_email`
This tool creates a draft email using the Gmail API. 

3. `update_draft_email`
This tool updates an existing draft email using the Gmail API.

4. `send_draft_email`
This tool sends a draft email using the Gmail API.

5. `delete_draft_email`
This tool deletes a draft email using the Gmail API. 

6. `list_draft_emails`
This tool retrieves a list of draft emails using the Gmail API.

7. `list_emails_by_header`
This tool searches for emails by a specific header using the Gmail API.
- `sender`: The sender's email address to search for.
- `limit`: The maximum number of emails to retrieve.

8. `list_emails`
This tool retrieves a list of emails using the Gmail API.

9. `trash_email`
This tool moves an email to the trash using the Gmail API.
2024-09-19 10:18:49 -07:00
Nate Barbettini
6d854b0110
Update requires_authorization and other naming (#39)
Corresponds to Engine PR: https://github.com/ArcadeAI/Engine/pull/73
2024-09-19 09:51:28 -07:00
Sam Partee
db948125d5
Tool Evalulation SDK (#35)
1. New Eval SDK (`arcade/sdk/eval.py`):
- Introduces `EvalSuite`, `EvalCase`, and `EvalRubric` classes for
structured evaluation.
- Implements various Critic classes (Binary, Numeric, Similarity) for
flexible scoring.
- Adds a `tool_eval` decorator for easy integration with existing tools.

2. CLI Integration (`arcade/cli/main.py` and `arcade/cli/utils.py`):
   - Adds an `evals` command to run evaluation suites from the CLI.
   - Implements result display functionality for evaluation outcomes.

3. Toolkit Updates:
- Adds evaluation scripts for Gmail
([toolkits/gmail/evals/eval_gmail_tools.py](file:///Users/spartee/Dropbox/Arcade/platform/Team/arcade-ai/toolkits/gmail/evals/eval_gmail_tools.py#1%2C1-1%2C1))
and Slack
([toolkits/slack/evals/eval_slack_messaging.py](file:///Users/spartee/Dropbox/Arcade/platform/Team/arcade-ai/toolkits/slack/evals/eval_slack_messaging.py#1%2C1-1%2C1))
toolkits.
- Demonstrates practical usage of the Eval SDK with real-world
scenarios.

4. Miscellaneous:
- Updates `arcade/cli/new.py` to optionally generate an `evals`
directory for new toolkits.

---------

Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2024-09-19 03:36:44 -07:00
Nate Barbettini
e4839195d7
Actor: Use shared secret for Actor auth (#40)
Actor side of https://github.com/ArcadeAI/Engine/pull/78 (see comments
there)
2024-09-17 17:03:40 -07:00
Nate Barbettini
f4fe8c7892
Clean up provider properties (scopes) (#42)
In this PR:
- Rename `scope` to `scopes` so it is more understandable by humans
- DRY up provider structs, it was starting to get silly with so many
providers that just have 1 property called `scopes`

Must go along with this Engine PR:
https://github.com/ArcadeAI/Engine/pull/79
2024-09-17 16:38:51 -07:00
Eric Gustin
ce4a9b28a9
Add minor changes found during onboarding (#37)
* Add new tool to the arithmetic toolkit for summation of a range.
* Add ability to attach debugger to cli. Use `.vscode/launch.json`'s
"Debug arcade dev" to do so.
* Fix issue in cli's main that used the incorrect url.
2024-09-12 16:52:36 -07:00
Nate Barbettini
5726778f11
SDK support for lists (arrays) in tool inputs & outputs (#36)
Working:
- Declare tool functions that have `list[str]` (etc) as input parameter
or output values
- Engine can call these functions!

<img width="1195" alt="image"
src="https://github.com/user-attachments/assets/2aeb3c98-950a-4e2f-a8c7-39102e3fb7f0">
2024-09-12 16:31:12 -07:00
Sterling Dreyer
345b685b08
Deploy Actor Image (#34) 2024-09-10 10:07:31 -07:00
Nate Barbettini
c59bb678dd
Override Actor auth for easier dev testing (#33)
In this PR:
- The Actor health check route now _never_ requires auth (bearer token).
It is always unprotected.
- `arcade dev --no-auth` disables all Actor auth entirely, making all
routes unprotected. Useful for debugging, but emits a warning to the
console.
2024-09-10 09:39:12 -07:00
Nate Barbettini
75c6a2becf
arcade chat: allow overriding host, port, TLS (#31)
Adds:
- New options to `arcade chat`: `-h/--host`, `-p/--port`, and
`--tls/--notls`. This allows us to point `arcade chat` at a different
server than what's configured in `arcade.toml` which is very helpful for
debugging.
- Special case: if you do `-h localhost`, it will automatically use port
9099 and no TLS unless otherwise specified.
- Adds a non-fatal engine health check to `arcade chat` startup:

<img width="499" alt="image"
src="https://github.com/user-attachments/assets/b7fae29e-2f8d-4004-a27b-645b4cd997a8">
2024-09-10 09:25:05 -07:00
Sam Partee
d12542db55
Tool auth (#30)
Note - This Engine PR must go first:
https://github.com/ArcadeAI/Engine/pull/65

In this PR:
- Add `client.tool.authorize` to authorize a tool by name by @Spartee 
- Refactored client.auth methods to always pass around scopes (as needed
by the above Engine PR) by @nbarbettini
- Reduced the scopes needed in the Slack toolkit, which was blocked by
this until now! @nbarbettini

---------

Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
2024-09-09 15:00:17 -07:00
Nate Barbettini
408f2e6300
gmail: search_emails_by_header tool (#28)
Adds a new gmail tool to search email, plus some cleanup.
2024-08-30 15:29:02 -07:00
Nate Barbettini
aa1b59497b
QOL improvements for arcade chat (#27)
Includes these improvements:
- Up-arrow loads your previous message history in the session (if
available)
- Shows the target engine URL when the chat starts
- Shows the model name in the chat: e.g. `Assistant (gpt-4o-mini): `
- URLs are re-written as clickable markdown links in the chat output
- mypy cleanup
2024-08-30 13:06:38 -07:00
Nate Barbettini
950e075750
arcade login in CLI (#25)
Working now:
- `arcade login` works against the Cloud
- `arcade logout` deletes your local credentials

---------

Co-authored-by: Sam Partee <sam@arcade-ai.com>
2024-08-30 11:20:00 -07:00
Sam Partee
aee706e118
Developer Makefile and Docker steps (#26)
Simpler docker build for the Actor and makefile
2024-08-29 21:24:46 -07:00
Sam Partee
e9a8d6b7f2
Engine API Keys (#24) 2024-08-29 09:22:09 -07:00