anthropics / anthropic-sdk-typescript

Access to Anthropic's safety-first language model APIs
https://www.npmjs.com/package/@anthropic-ai/sdk
MIT License
745 stars 79 forks source link

vertex-sdk: Add gcp-labels to llm calls #619

Open mktce opened 1 day ago

mktce commented 1 day ago

When using gemini models via vertex API, it is possible to add gcp labels to API calls (https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls). It would be very helpful, if the same was possible for anthropic calls via vertex API.

RobertCraigie commented 17 hours ago

Thanks for the request, what would you want the SDK interface to be?

mktce commented 1 hour ago

I could imagine, that analogous to Google's generateContent endpoint (see https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.endpoints/generateContent), the MessageCreateParamsBase gets a new property labels that can be used on each create-call, like:

const result = await client.messages.create({
    messages: [{role: 'user', content: 'Hey Claude!'}],
    model: 'claude-3-5-sonnet-v2@20241022',
    labels: {
        'component': 'frontend',
        'team': 'research'
    }
});