scrimba
Mistral AI
Function calling
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Function calling
Expand for more info
index.js
run
preview
console
import MistralClient from '@mistralai/mistralai';
import { tools } from "./tools";
const client = new MistralClient(process.env.MISTRAL_API_KEY);

async function agent(query) {
const messages = [
{ role: "user", content: query }
];

const response = await client.chat( {
model: 'mistral-large-latest',
messages: messages,
tools: tools
});

return response;
}

const response = await agent("Is the transaction T1001 paid?");

console.log(response);
Console
/index.html
-4:04