Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tool call accuracy #1311

Merged
merged 5 commits into from
Sep 18, 2024

Conversation

shahules786
Copy link
Member

@shahules786 shahules786 commented Sep 13, 2024

from ragas.dataset_schema import  MultiTurnSample
from ragas.messages import HumanMessage,AIMessage,ToolMessage,ToolCall
from ragas.metrics._tool_call_accuracy import ToolCallAccuracy


sample = MultiTurnSample(user_input=[
    HumanMessage(content="Hey, book a table at the nearest best Chinese restaurant for 8:00pm"),
    AIMessage(content="Sure, let me find the best options for you.", tool_calls=[
        ToolCall(name="restaurant_search", args={"cuisine": "Asian", "time": "8:00pm"})
    ]),
              ],
    reference_tool_calls=[ToolCall(name="restaurant_book", args={"name": "Golden", "time": "8:00pm"})
])

scorer = ToolCallAccuracy()
await metric.multi_turn_ascore(sample)

@shahules786 shahules786 changed the title tool call accuracy feat: tool call accuracy Sep 13, 2024
@shahules786 shahules786 marked this pull request as ready for review September 14, 2024 04:59
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 14, 2024
@shahules786 shahules786 merged commit 478abc1 into explodinggradients:main Sep 18, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants