cloudflare / cloudflare/ai-utils

How to Identify Which Functions Were Executed in runWithTools?

Open
#10 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
196
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Hi Cloudflare team,

I am using the `@hf/nousresearch/hermes-2-pro-mistral-7b` model with the `runWithTools` function and an array of `tools` (the `tools` object). I have the following question:

Is it possible to identify which functions within the `tools` array were actually executed by the model, if any?

For example:

```ts
const r = await runWithTools(ai, '@hf/nousresearch/hermes-2-pro-mistral-7b', {
messages: [.....],
tools: [....]
});

console.log(r.tool_calls)
```

I noticed that the constant `r` returns an object, but the `tool_calls` field in the response does not seem to include information about the executed functions. My specific questions are:

1. Under what circumstances does the `tool_calls` field in the response include relevant data?
2. Is there any explicit way to track which functions were called during the model's execution?

Thanks in advance for your help!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.