import { Mistral } from "@mistralai/mistralai";
import process from "node:process";
import { HoneyHiveTracer } from 'honeyhive';
const tracer = await HoneyHiveTracer.init({
apiKey: "MY_HONEYHIVE_API_KEY",
project: "MY_HONEYHIVE_PROJECT_NAME",
sessionName: "mistral",
});
const mistral = new Mistral({
apiKey: process.env["MISTRAL_API_KEY"] ?? "",
});
async function run(input: string): Promise<any> {
const result = await mistral.chat.complete({
model: "mistral-small-latest",
messages: [
{
role: "user",
content: input,
},
],
});
// Handle the result
console.log(result);
return result;
}
const tracedRun = tracer.traceFunction()(run);
await tracedRun("Who is the best French painter? Answer in one short sentence.");