Reviewer:
1. DM me to get a client ID/secret for the Hubspot app and login
credentials for a sample Hubspot account
2. For now, you'll need to run the engine on the branch
`nate/token-introspection` for the auth flow to work with Hubspot
3. Add the following to `auth.providers` in your engine yaml:
```yaml
- id: arcade-hubspot
description: 'Hubspot provider'
enabled: true
type: oauth2
provider_id: hubspot
client_id: ${env:HUBSPOT_CLIENT_ID}
client_secret: ${env:HUBSPOT_CLIENT_SECRET}
```
194 lines
5.8 KiB
Python
194 lines
5.8 KiB
Python
from arcade.sdk import ToolCatalog
|
|
from arcade.sdk.eval import (
|
|
BinaryCritic,
|
|
EvalRubric,
|
|
EvalSuite,
|
|
ExpectedToolCall,
|
|
tool_eval,
|
|
)
|
|
|
|
import arcade_hubspot
|
|
from arcade_hubspot.tools import get_company_data_by_keywords
|
|
|
|
rubric = EvalRubric(
|
|
fail_threshold=0.8,
|
|
warn_threshold=0.9,
|
|
)
|
|
|
|
|
|
catalog = ToolCatalog()
|
|
catalog.add_module(arcade_hubspot)
|
|
|
|
|
|
@tool_eval()
|
|
def get_company_data_by_keywords_eval_suite() -> EvalSuite:
|
|
"""Create an evaluation suite for the get_company_data_by_keywords tool."""
|
|
suite = EvalSuite(
|
|
name="Get Company Data by Keywords",
|
|
system_message="You are an AI assistant that can interact with Hubspot CRM using the provided tools.",
|
|
catalog=catalog,
|
|
rubric=rubric,
|
|
)
|
|
|
|
suite.add_case(
|
|
name="Get company data by keywords",
|
|
user_message="Get information about the Acme company.",
|
|
expected_tool_calls=[
|
|
ExpectedToolCall(
|
|
func=get_company_data_by_keywords,
|
|
args={
|
|
"keywords": "Acme",
|
|
"limit": 10,
|
|
"next_page_token": None,
|
|
},
|
|
),
|
|
],
|
|
rubric=rubric,
|
|
critics=[
|
|
BinaryCritic(critic_field="keywords", weight=0.8),
|
|
BinaryCritic(critic_field="next_page_token", weight=0.2),
|
|
],
|
|
)
|
|
|
|
suite.add_case(
|
|
name="Get company data by keywords with limit",
|
|
user_message="Get information of up to 3 companies with the word 'Acme' in their name.",
|
|
expected_tool_calls=[
|
|
ExpectedToolCall(
|
|
func=get_company_data_by_keywords,
|
|
args={
|
|
"keywords": "Acme",
|
|
"limit": 3,
|
|
"next_page_token": None,
|
|
},
|
|
),
|
|
],
|
|
rubric=rubric,
|
|
critics=[
|
|
BinaryCritic(critic_field="keywords", weight=0.6),
|
|
BinaryCritic(critic_field="limit", weight=0.3),
|
|
BinaryCritic(critic_field="next_page_token", weight=0.1),
|
|
],
|
|
)
|
|
|
|
suite.add_case(
|
|
name="Get summary of company activity",
|
|
user_message="Get a summary of the latest activities in the Acme company.",
|
|
expected_tool_calls=[
|
|
ExpectedToolCall(
|
|
func=get_company_data_by_keywords,
|
|
args={
|
|
"keywords": "Acme",
|
|
"limit": 10,
|
|
"next_page_token": None,
|
|
},
|
|
),
|
|
],
|
|
rubric=rubric,
|
|
critics=[
|
|
BinaryCritic(critic_field="keywords", weight=0.8),
|
|
BinaryCritic(critic_field="next_page_token", weight=0.2),
|
|
],
|
|
)
|
|
|
|
suite.add_case(
|
|
name="Interactions with contacts of an account",
|
|
user_message="Get me the interactions with the contacts of the Acme company.",
|
|
expected_tool_calls=[
|
|
ExpectedToolCall(
|
|
func=get_company_data_by_keywords,
|
|
args={
|
|
"keywords": "Acme",
|
|
"limit": 10,
|
|
"next_page_token": None,
|
|
},
|
|
),
|
|
],
|
|
rubric=rubric,
|
|
critics=[
|
|
BinaryCritic(critic_field="keywords", weight=0.8),
|
|
BinaryCritic(critic_field="next_page_token", weight=0.2),
|
|
],
|
|
)
|
|
|
|
suite.add_case(
|
|
name="Emails or calls with contacts of an account",
|
|
user_message="Were there any emails or calls with contacts of the Acme company this week?",
|
|
expected_tool_calls=[
|
|
ExpectedToolCall(
|
|
func=get_company_data_by_keywords,
|
|
args={
|
|
"keywords": "Acme",
|
|
"limit": 10,
|
|
"next_page_token": None,
|
|
},
|
|
),
|
|
],
|
|
rubric=rubric,
|
|
critics=[
|
|
BinaryCritic(critic_field="keywords", weight=0.8),
|
|
BinaryCritic(critic_field="next_page_token", weight=0.2),
|
|
],
|
|
)
|
|
|
|
suite.add_case(
|
|
name="Get company status",
|
|
user_message="What's the status of the Acme company?",
|
|
expected_tool_calls=[
|
|
ExpectedToolCall(
|
|
func=get_company_data_by_keywords,
|
|
args={
|
|
"keywords": "Acme",
|
|
"limit": 10,
|
|
"next_page_token": None,
|
|
},
|
|
),
|
|
],
|
|
rubric=rubric,
|
|
critics=[
|
|
BinaryCritic(critic_field="keywords", weight=0.8),
|
|
BinaryCritic(critic_field="next_page_token", weight=0.2),
|
|
],
|
|
)
|
|
|
|
suite.add_case(
|
|
name="Get overdue tasks",
|
|
user_message="Are there any tasks overdue for the Acme company?",
|
|
expected_tool_calls=[
|
|
ExpectedToolCall(
|
|
func=get_company_data_by_keywords,
|
|
args={
|
|
"keywords": "Acme",
|
|
"limit": 10,
|
|
"next_page_token": None,
|
|
},
|
|
),
|
|
],
|
|
rubric=rubric,
|
|
critics=[
|
|
BinaryCritic(critic_field="keywords", weight=0.8),
|
|
BinaryCritic(critic_field="next_page_token", weight=0.2),
|
|
],
|
|
)
|
|
|
|
suite.add_case(
|
|
name="Get company closing likelihood",
|
|
user_message="What's the likelihood of the Acme company closing a deal?",
|
|
expected_tool_calls=[
|
|
ExpectedToolCall(
|
|
func=get_company_data_by_keywords,
|
|
args={
|
|
"keywords": "Acme",
|
|
"limit": 10,
|
|
"next_page_token": None,
|
|
},
|
|
),
|
|
],
|
|
rubric=rubric,
|
|
critics=[
|
|
BinaryCritic(critic_field="keywords", weight=0.8),
|
|
BinaryCritic(critic_field="next_page_token", weight=0.2),
|
|
],
|
|
)
|
|
|
|
return suite
|