Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
ref(core): Introduce instrumented method registry for AI integrations#19981
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
6b1f2441f47c328ebae83a3b3d3e1a368b1c18efbe6806fbae3e1e59d02e8196fa9aa78d318f906998ac90fd6db114e21e0e894f22a5dc3393b06e4443a294File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,15 @@ | ||
| import type { InstrumentedMethodRegistry } from '../ai/utils'; | ||
| export const ANTHROPIC_AI_INTEGRATION_NAME = 'Anthropic_AI'; | ||
| // https://docs.anthropic.com/en/api/messages | ||
| // https://docs.anthropic.com/en/api/models-list | ||
| export const ANTHROPIC_AI_INSTRUMENTED_METHODS = [ | ||
| 'messages.create', | ||
| 'messages.stream', | ||
| 'messages.countTokens', | ||
| 'models.get', | ||
| 'completions.create', | ||
| 'models.retrieve', | ||
| 'beta.messages.create', | ||
| ] as const; | ||
| export const ANTHROPIC_METHOD_REGISTRY = { | ||
| 'messages.create': { operation: 'chat' }, | ||
| 'messages.stream': { operation: 'chat', streaming: true }, | ||
| 'messages.countTokens': { operation: 'chat' }, | ||
| 'models.get': { operation: 'models' }, | ||
| 'completions.create': { operation: 'chat' }, | ||
| 'models.retrieve': { operation: 'models' }, | ||
| 'beta.messages.create': { operation: 'chat' }, | ||
| } as const satisfies InstrumentedMethodRegistry; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,19 @@ | ||
| import type { InstrumentedMethodRegistry } from '../ai/utils'; | ||
| export const GOOGLE_GENAI_INTEGRATION_NAME = 'Google_GenAI'; | ||
| // https://ai.google.dev/api/rest/v1/models/generateContent | ||
| // https://ai.google.dev/api/rest/v1/chats/sendMessage | ||
| // https://googleapis.github.io/js-genai/release_docs/classes/models.Models.html#generatecontentstream | ||
| // https://googleapis.github.io/js-genai/release_docs/classes/chats.Chat.html#sendmessagestream | ||
| export const GOOGLE_GENAI_INSTRUMENTED_METHODS = [ | ||
| 'models.generateContent', | ||
| 'models.generateContentStream', | ||
| 'chats.create', | ||
| 'sendMessage', | ||
| 'sendMessageStream', | ||
| ] as const; | ||
| export const GOOGLE_GENAI_METHOD_REGISTRY = { | ||
| 'models.generateContent': { operation: 'generate_content' }, | ||
| 'models.generateContentStream': { operation: 'generate_content', streaming: true }, | ||
| 'chats.create': { operation: 'chat' }, | ||
| // chat.* paths are built by createDeepProxy when it proxies the chat instance with CHAT_PATH as base | ||
| 'chat.sendMessage': { operation: 'chat' }, | ||
| 'chat.sendMessageStream': { operation: 'chat', streaming: true }, | ||
nicohrubec marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } as const satisfies InstrumentedMethodRegistry; | ||
| // Constants for internal use | ||
| export const GOOGLE_GENAI_SYSTEM_NAME = 'google_genai'; | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: we could actually use CHAT_PATH here instead of hardcoding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll likely get rid of CHAT_PATH in a follow up, can think about introducing a more broad operations objects to handle all of these ops constants