arcade-mcp/toolkits/jira/evals/eval_create_update_issues.py
Sam Partee b6b4cd0a4c
🏗️ Restructure: Multi-Package Architecture + uv Migration (#412)
### Overview
Major restructuring from monolithic `arcade-ai` package to modular
library architecture with standardized uv-based dependency management.

![arcade-ai Monorepo
(2)](https://github.com/user-attachments/assets/25f102b0-bb87-4a04-9701-d227d05664b1)

### New Package Structure
- **`arcade-tdk`** - Lightweight toolkit development kit (core
decorators, auth)
- **`arcade-core`** - Core execution engine and catalog functionality  
- **`arcade-serve`** - FastAPI/MCP server components
- **`arcade-ai`** - Meta package that includes CLI functionality.
Optionally include evals via the `evals` extra. Optionally include all
packages via the `all` extra.

### Key Benefits
- **Lighter Dependencies**: Toolkits now depend only on `arcade-tdk` (~2
deps) vs full `arcade-ai` (~30+ deps)
- **Faster Builds**: uv provides 10-100x faster dependency resolution
and installation
- **Better Modularity**: Clear separation of concerns, consumers import
only what they need
- **Standard Tooling**: Eliminates custom poetry scripts, uses standard
Python packaging

### Migration Impact
- All 20 toolkits converted from poetry → uv with `arcade-tdk`
dependencies plus `arcade-ai[evals]` and `arcade-serve` dev
dependencies. When developing locally, devs should install toolkits via
`make install-local`.
- Modern Python 3.10+ type hints throughout
- Standardized build system with hatchling backend
- Enhanced Makefile with robust toolkit management commands
- Removed `arcade dev` CLI command
- Reduce the number of files created by `arcade new` and add an option
to not generate a tests and evals folder.

This foundation enables faster development cycles and cleaner dependency
chains for the growing toolkit ecosystem.

### Todo After this PR is merged
- [ ] Post-merge workflow(s) (release & publish containers, etc)
- [ ] Release order plan. @EricGustin suggests releasing in the
following order:
    1. `arcade-core` version 0.1.0
    2. `arcade-serve` version 0.1.0 and `arcade-tdk` version 0.1.0
    3. `arcade-ai` version 2.0.0
4. Patch release for all toolkits (all changes in toolkits are internal
refactors)
- [ ] [Update docs](https://github.com/ArcadeAI/docs/pull/318)

---------

Co-authored-by: Eric Gustin <eric@arcade.dev>
Co-authored-by: Eric Gustin <34000337+EricGustin@users.noreply.github.com>
2025-06-11 16:48:17 -07:00

389 lines
12 KiB
Python

from arcade_evals import (
EvalRubric,
EvalSuite,
ExpectedToolCall,
tool_eval,
)
from arcade_evals.critic import BinaryCritic
from arcade_tdk import ToolCatalog
import arcade_jira
from arcade_jira.critics import (
CaseInsensitiveBinaryCritic,
CaseInsensitiveListOfStringsBinaryCritic,
)
from arcade_jira.tools.issues import (
add_labels_to_issue,
create_issue,
remove_labels_from_issue,
update_issue,
)
# Evaluation rubric
rubric = EvalRubric(
fail_threshold=0.85,
warn_threshold=0.95,
)
catalog = ToolCatalog()
catalog.add_module(arcade_jira)
@tool_eval()
def create_issue_eval_suite() -> EvalSuite:
suite = EvalSuite(
name="Create issue eval suite",
system_message=(
"You are an AI assistant with access to Jira tools. "
"Use them to help the user with their tasks."
),
catalog=catalog,
rubric=rubric,
)
suite.add_case(
name="Create issue",
user_message="Create a 'High' priority task for John Doe with the following properties: "
"title: 'Test issue', "
"description: 'This is a test issue', "
"project: 'ENG-123', "
"issue_type: 'Task', "
"due on '2025-06-30'. "
"Label it with Hello and World.",
expected_tool_calls=[
ExpectedToolCall(
func=create_issue,
args={
"title": "Test issue",
"description": "This is a test issue",
"project": "ENG-123",
"issue_type": "Task",
"priority": "High",
"assignee": "John Doe",
"due_date": "2025-06-30",
"labels": ["Hello", "World"],
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="title", weight=1 / 8),
CaseInsensitiveBinaryCritic(critic_field="description", weight=1 / 8),
CaseInsensitiveBinaryCritic(critic_field="project", weight=1 / 8),
CaseInsensitiveBinaryCritic(critic_field="issue_type", weight=1 / 8),
CaseInsensitiveBinaryCritic(critic_field="priority", weight=1 / 8),
CaseInsensitiveBinaryCritic(critic_field="assignee", weight=1 / 8),
BinaryCritic(critic_field="due_date", weight=1 / 8),
CaseInsensitiveListOfStringsBinaryCritic(critic_field="labels", weight=1 / 8),
],
)
suite.add_case(
name="Create issue with parent and reporter",
user_message=(
"Create a task for John Doe to 'Implement message queue service' "
"as a child of the issue ENG-321 and reported by Jenifer Bear. "
"It should be due on 2025-06-30. "
"Label it with 'Project XYZ'."
),
expected_tool_calls=[
ExpectedToolCall(
func=create_issue,
args={
"title": "Implement message queue service",
"parent_issue": "ENG-321",
"issue_type": "Task",
"assignee": "John Doe",
"reporter": "Jenifer Bear",
"due_date": "2025-06-30",
"labels": ["Project XYZ"],
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="title", weight=1 / 7),
CaseInsensitiveBinaryCritic(critic_field="parent_issue", weight=1 / 7),
CaseInsensitiveBinaryCritic(critic_field="issue_type", weight=1 / 7),
CaseInsensitiveBinaryCritic(critic_field="assignee", weight=1 / 7),
CaseInsensitiveBinaryCritic(critic_field="reporter", weight=1 / 7),
BinaryCritic(critic_field="due_date", weight=1 / 7),
CaseInsensitiveListOfStringsBinaryCritic(critic_field="labels", weight=1 / 7),
],
)
return suite
@tool_eval()
def labels_eval_suite() -> EvalSuite:
suite = EvalSuite(
name="Labels eval suite",
system_message=(
"You are an AI assistant with access to Jira tools. "
"Use them to help the user with their tasks."
),
catalog=catalog,
rubric=rubric,
)
suite.add_case(
name="Add labels",
user_message="Add the labels 'Hello' and 'World' to the issue ENG-123.",
expected_tool_calls=[
ExpectedToolCall(
func=add_labels_to_issue,
args={
"issue": "ENG-123",
"labels": ["Hello", "World"],
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=0.5),
CaseInsensitiveListOfStringsBinaryCritic(critic_field="labels", weight=0.5),
],
)
suite.add_case(
name="Add labels without notifying watchers",
user_message=(
"Add the labels 'Hello' and 'World' to the issue ENG-123. Do not notify watchers."
),
expected_tool_calls=[
ExpectedToolCall(
func=add_labels_to_issue,
args={
"issue": "ENG-123",
"labels": ["Hello", "World"],
"notify_watchers": False,
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=1 / 3),
CaseInsensitiveListOfStringsBinaryCritic(critic_field="labels", weight=1 / 3),
BinaryCritic(critic_field="notify_watchers", weight=1 / 3),
],
)
suite.add_case(
name="Remove labels",
user_message="Remove the labels 'Hello' and 'World' from the issue ENG-123.",
expected_tool_calls=[
ExpectedToolCall(
func=remove_labels_from_issue,
args={
"issue": "ENG-123",
"labels": ["Hello", "World"],
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=0.5),
CaseInsensitiveListOfStringsBinaryCritic(critic_field="labels", weight=0.5),
],
)
suite.add_case(
name="Remove labels without notifying watchers",
user_message=(
"Remove the labels 'Hello' and 'World' from the issue ENG-123. Do not notify watchers."
),
expected_tool_calls=[
ExpectedToolCall(
func=remove_labels_from_issue,
args={
"issue": "ENG-123",
"labels": ["Hello", "World"],
"notify_watchers": False,
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=1 / 3),
CaseInsensitiveListOfStringsBinaryCritic(critic_field="labels", weight=1 / 3),
BinaryCritic(critic_field="notify_watchers", weight=1 / 3),
],
)
return suite
@tool_eval()
def update_issue_eval_suite() -> EvalSuite:
suite = EvalSuite(
name="Update issue eval suite",
system_message=(
"You are an AI assistant with access to Jira tools. "
"Use them to help the user with their tasks."
),
catalog=catalog,
rubric=rubric,
)
suite.add_case(
name="Update issue with new assignee",
user_message="Change the assignee of the ENG-123 issue to John Doe.",
expected_tool_calls=[
ExpectedToolCall(
func=update_issue,
args={
"issue": "ENG-123",
"assignee": "John Doe",
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=0.5),
CaseInsensitiveBinaryCritic(critic_field="assignee", weight=0.5),
],
)
suite.add_case(
name="Update issue with new priority",
user_message="Set the priority of the ENG-123 issue to high.",
expected_tool_calls=[
ExpectedToolCall(
func=update_issue,
args={
"issue": "ENG-123",
"priority": "High",
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=0.5),
CaseInsensitiveBinaryCritic(critic_field="priority", weight=0.5),
],
)
suite.add_case(
name="Update issue with new due date",
user_message="Set the due date of the ENG-123 issue to 2025-06-30.",
expected_tool_calls=[
ExpectedToolCall(
func=update_issue,
args={
"issue": "ENG-123",
"due_date": "2025-06-30",
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=0.5),
CaseInsensitiveBinaryCritic(critic_field="due_date", weight=0.5),
],
)
suite.add_case(
name="Update issue with new labels",
user_message="Change the labels in the ENG-123 issue to 'Hello' and 'World'.",
expected_tool_calls=[
ExpectedToolCall(
func=update_issue,
args={
"issue": "ENG-123",
"labels": ["Hello", "World"],
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=0.5),
CaseInsensitiveListOfStringsBinaryCritic(critic_field="labels", weight=0.5),
],
)
suite.add_case(
name="Update issue with new title and description",
user_message=(
"Change the title and description of the ENG-123 issue to 'Test issue' "
"and 'This is a test issue'."
),
expected_tool_calls=[
ExpectedToolCall(
func=update_issue,
args={
"issue": "ENG-123",
"title": "Test issue",
"description": "This is a test issue",
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=1 / 3),
CaseInsensitiveBinaryCritic(critic_field="title", weight=1 / 3),
CaseInsensitiveBinaryCritic(critic_field="description", weight=1 / 3),
],
)
suite.add_case(
name="Clear due date",
user_message="Clear the due date of the issue ENG-123.",
expected_tool_calls=[
ExpectedToolCall(
func=update_issue,
args={
"issue": "ENG-123",
"due_date": "",
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=0.5),
CaseInsensitiveBinaryCritic(critic_field="due_date", weight=0.5),
],
)
suite.add_case(
name="Remove assignee",
user_message="Remove the assignee from the issue ENG-123.",
expected_tool_calls=[
ExpectedToolCall(
func=update_issue,
args={
"issue": "ENG-123",
"assignee": "",
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=0.5),
CaseInsensitiveBinaryCritic(critic_field="assignee", weight=0.5),
],
)
suite.add_case(
name="Remove assignee",
user_message="Remove the assignee from the issue ENG-123 without notifying anyone.",
expected_tool_calls=[
ExpectedToolCall(
func=update_issue,
args={
"issue": "ENG-123",
"assignee": "",
"notify_watchers": False,
},
),
],
rubric=rubric,
critics=[
CaseInsensitiveBinaryCritic(critic_field="issue", weight=1 / 3),
CaseInsensitiveBinaryCritic(critic_field="assignee", weight=1 / 3),
BinaryCritic(critic_field="notify_watchers", weight=1 / 3),
],
)
return suite