@@ -36,18 +36,22 @@ const chatModelConfig = ['dist/language_models/chat_models.cjs', 'dist/language_
3636// is the module hooked for it. (anthropic and groq are chat-only — they ship no embeddings class.) The
3737// `embedQuery`/`embedDocuments` channel names are per-method; orchestrion prefixes them with the module
3838// name, so the full channel strings stay distinct across packages.
39+ const EMBED_QUERY = 'embedQuery' ;
40+ const EMBED_DOCUMENTS = 'embedDocuments' ;
41+
3942const EMBEDDINGS_PROVIDERS = [
40- { name : '@langchain/openai' , versionRange : '>=0.1.0 <2.0.0' } ,
41- { name : '@langchain/google-genai' , versionRange : '>=0.1.0 <3.0.0' } ,
42- { name : '@langchain/mistralai' , versionRange : '>=0.1.0 <2.0.0' } ,
43- { name : '@langchain/google-common' , versionRange : '>=0.1.0 <3.0.0' } ,
43+ { name : '@langchain/openai' , versionRange : '>=0.1.0 <2.0.0' , methods : [ EMBED_QUERY , EMBED_DOCUMENTS ] } ,
44+ { name : '@langchain/google-genai' , versionRange : '>=0.1.0 <3.0.0' , methods : [ EMBED_QUERY , EMBED_DOCUMENTS ] } ,
45+ { name : '@langchain/mistralai' , versionRange : '>=0.1.0 <2.0.0' , methods : [ EMBED_QUERY , EMBED_DOCUMENTS ] } ,
46+ // `@langchain/google-vertexai` inherits its embed methods from this shared base. The base's
47+ // `embedQuery` delegates to `embedDocuments`, so hooking only `embedDocuments` still traces both
48+ // entry points as a single span each, instead of emitting a nested duplicate for `embedQuery`.
49+ { name : '@langchain/google-common' , versionRange : '>=0.1.0 <3.0.0' , methods : [ EMBED_DOCUMENTS ] } ,
4450] ;
4551
46- const EMBEDDINGS_METHODS = [ 'embedQuery' , 'embedDocuments' ] as const ;
47-
48- const embeddingsConfig = EMBEDDINGS_PROVIDERS . flatMap ( ( { name, versionRange } ) =>
52+ const embeddingsConfig = EMBEDDINGS_PROVIDERS . flatMap ( ( { name, versionRange, methods } ) =>
4953 [ 'dist/embeddings.cjs' , 'dist/embeddings.js' ] . flatMap ( filePath =>
50- EMBEDDINGS_METHODS . map ( method => ( {
54+ methods . map ( method => ( {
5155 channelName : method ,
5256 module : { name, versionRange, filePath } ,
5357 functionQuery : { methodName : method , kind : 'Async' as const } ,
@@ -59,8 +63,8 @@ export const langchainConfig = [...chatModelConfig, ...embeddingsConfig] satisfi
5963
6064// The embeddings channel strings the subscriber binds to, derived from the provider list above so that
6165// adding a provider is a single edit that both instruments it and subscribes the listener to it.
62- export const langchainEmbeddingsChannels = EMBEDDINGS_PROVIDERS . flatMap ( ( { name } ) =>
63- EMBEDDINGS_METHODS . map ( method => `orchestrion:${ name } :${ method } ` ) ,
66+ export const langchainEmbeddingsChannels = EMBEDDINGS_PROVIDERS . flatMap ( ( { name, methods } ) =>
67+ methods . map ( method => `orchestrion:${ name } :${ method } ` ) ,
6468) ;
6569
6670export const langchainChannels = {
0 commit comments