-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
For example, Agent component with the following config:
export const titleAgent = new Agent(components.agent, {
languageModel: "openai/gpt-4o-mini",
usageHandler: async (ctx, args) => {
const gateway = args.providerMetadata?.gateway;
if (!gateway) {
throw new Error("Missing providerMetadata.gateway");
}
const creditsSpent = costToCredits(gateway.cost);
...
};
});
works just fine.
And RAG component with the same config (it only has an additional textEmbeddingModel: "openai/text-embedding-3-small") throws an error because args.providerMetadata is missing.
Please, add it, otherwise I have to calculate the cost myself. Not a big deal, but still would like not to hardcode input and output token cost.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels