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

Function calling #53

Open
savikko opened this issue Feb 29, 2024 · 8 comments
Open

Function calling #53

savikko opened this issue Feb 29, 2024 · 8 comments
Assignees

Comments

@savikko
Copy link

savikko commented Feb 29, 2024

Hi!

What is the way to call (Mistral Large) functions with this client?

I did not find even any mentions about functions on API documentation (https://docs.mistral.ai/api/#operation/createChatCompletion)

@jfhenon
Copy link

jfhenon commented Feb 29, 2024

Hi!

What is the way to call (Mistral Large) functions with this client?

I did not find even any mentions about functions on API documentation (https://docs.mistral.ai/api/#operation/createChatCompletion)

+1

@savikko
Copy link
Author

savikko commented Mar 1, 2024

And regarding Azure Mistral Large, they say this:

Does Mistral Large on Azure support function calling and Json output?

The Mistral Large model can do function calling and generate Json output, but support for those features will roll out soon on the Azure platform.

@thibautvdu
Copy link

Anyone using La Plateforme with javascript successfully tried function calling ?

According to the typescript definitions of this package at the moment, the function calling would be only available with streaming (client.chatStream), but I cannot get it to work either way (streaming or async).

Using mistral-large-latest, it seems that the model is aware fo which function it should call, but tool_calls is always empty and the model output "[Function Call: 'get-cart']" straight into the content.

Request call :

      const completions = this.mistralClient.chatStream({
        model: targetModel,
        messages: [this.getPrompt(), ...messages],
        tools: this.getTools(),
        responseFormat: {
          type: "text" as ResponseFormats,
        },
      });

      let content = "";
      for await (const completionChunk of completions) {
        const choice = completionChunk.choices[0];
        content += choice.delta.content || "";
        if (choice.delta.tool_calls) {
          toolCalls = choice.delta.tool_calls;
        }
      }

Answer :

dashboard:dev: Received completion {
dashboard:dev:   content: `{"answer": "Bien sûr, laissez-moi vous montrer le contenu de votre panier. 💰›’\\n\\n[Function Call: 'get-cart']", "thoughts": "I need to call the 'get-cart' function to retrieve the current items in the user's cart."}`,
dashboard:dev:   toolCalls: undefined
dashboard:dev: }

@lucas-vitrus
Copy link

+1

Same issue, no tools on the javascript client.

@johannbuscail
Copy link

Any update on this ?

@briannezhad
Copy link

+1

@JamieLee0510
Copy link

JamieLee0510 commented May 3, 2024

Anyone using La Plateforme with javascript successfully tried function calling ?

According to the typescript definitions of this package at the moment, the function calling would be only available with streaming (client.chatStream), but I cannot get it to work either way (streaming or async).

Using mistral-large-latest, it seems that the model is aware fo which function it should call, but tool_calls is always empty and the model output "[Function Call: 'get-cart']" straight into the content.

Request call :

      const completions = this.mistralClient.chatStream({
        model: targetModel,
        messages: [this.getPrompt(), ...messages],
        tools: this.getTools(),
        responseFormat: {
          type: "text" as ResponseFormats,
        },
      });
      }

Maybe could try setting the toolChoice option to valueany?
I could use function_call in my cases, especially by model mistral-large-latest

@fuegoio
Copy link
Contributor

fuegoio commented May 8, 2024

Hi everyone! Thanks all for your contribution and apologize for the delay of answer.

Function calling is properly working on the JS client, in normal and streaming mode. The latest release (0.2.0) should fix the typescript definitions.

We are aware of model issues (not related to this client) when having function calls after some text for example. We would appreciate a lot reproductible example of those issues. @thibautvdu @lucas-vitrus @briannezhad @johannbuscail do you have examples of prompt + tools that you give to the model where it answers badly?

@fuegoio fuegoio self-assigned this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants