Propriétés
projectId
projectId : string
settings
settings : object
attributes
Un ensemble d’attributs appliqués à chaque trace produite par ce client.readonlyattributes:Record<string,any>
genai
readonlygenai :objet
genai.batchOptions
Configuration deoptionalbatchOptions :BufferConfig
BatchSpanProcessor. Ignorée sauf si spanProcessor === 'batch'.
genai.spanProcessor
Mode d’export des spans GenAI.optionalspanProcessor:"batch"|"simple"|SpanProcessor
'batch'(par défaut) :BatchSpanProcessor, adapté aux agents en production et aux processus de longue durée.'simple':SimpleSpanProcessor, une requête HTTP POST par span. Utile pour les tests et les CLI de courte durée, lorsqu’un vidage déterministe importe plus que le débit.- Instance de
SpanProcessor: un processor fourni par l’utilisateur. L’appelant gère son cycle de vie ; l’exporter OTLP de Weave ciblant/agents/otel/v1/tracesn’est pas utilisé.
printCallLink
Affiche dans le terminal les liens vers l’interface Weave pour les ops.readonlyprintCallLink:boolean
Par défaut
true
useCallsComplete
useCallsComplete : boolean
Envoie les appels terminés au point de terminaison calls/complete (début et fin
appariés côté client) au lieu de l’ancien chemin call/upsert_batch.
Par défaut
true
useOTelV2
useOTelV2 : boolean
Achemine les intégrations compatibles OTel via leur variante OTel.
Par défaut
true
traceServerApi
traceServerApi:Api<any>
Méthodes
addScore()
addScore(Ajoute le résultat d’un scorer (par exemple, sa sortie) à un appel. Utilisé dans une évaluation impérative pour joindre les résultats du scorer aux appels de prédiction.predictCallId,scorerCallId,runnableRefUri,scorerOutput) :Promise<string>
Paramètres
string
requis
ID de l’appel predict auquel joindre le feedback
string
requis
ID de l’appel du scorer ayant généré le feedback
string
requis
URI du scorer (réf. d’op ou d’objet)
any
requis
Sortie du scorer
Renvoie
Promise<string>
createCall()
createCall(internalCall,opRef,params,parameterNames,thisArg,currentCall,parentCall,startTime,displayName?,attributes?,eagerCallStart?) :Promise<void>
Paramètres
InternalCall
requis
any
requis
any[]
requis
undefined | "useParam0Object" | string[]
requis
any
requis
object
requis
{…} | undefined
requis
Type complet :
{ callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefinedDate
requis
string
Record<string, any>
boolean = false
Renvoie
Promise<void>
finishCall()
finishCall(call,result,currentCall,parentCall,summarize,endTime,startCallPromise):Promise<void>
Paramètres
InternalCall
requis
any
requis
object
requis
{…} | undefined
requis
Type complet :
{ callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefined((result) => Record<string, any>) | undefined
requis
Date
requis
Promise<void>
requis
Renvoie
Promise<void>
finishCallWithException()
finishCallWithException(call,error,currentCall,parentCall,endTime,startCallPromise):Promise<void>
Paramètres
InternalCall
requis
any
requis
object
requis
{…} | undefined
requis
Type complet :
{ callId: string; childSummary: Record<string, any>; displayName?: string; opName?: string; traceId: string; } | undefinedDate
requis
Promise<void>
requis
Renvoie
Promise<void>
flush()
flush():Transmet au serveur tous les appels mis en mémoire tampon. À attendre avantPromise<void>
process.exit().
Renvoie
Promise<void>
get()
get(ref) :Promise<any>
Paramètres
Renvoie
Promise<any>
getAgentCustomAttributes()
getAgentCustomAttributes(Découvrez les clés d’attributs personnalisés typés observées dans les spans d’agent du projet. Chaque ligne de résultat correspond à un tripletoptions):Promise<Réponse<{attributes?:object[];has_more?:boolean;limit?:number;offset?:number; }>>
(source, key, value_type), accompagné du
nombre de spans qui le portent. Les API de requête, de regroupement et de statistiques des
spans l’utilisent pour référencer les attributs personnalisés.
Filtrez les spans pris en compte en transmettant query (un filtre de span
structuré), startedAfter / startedBefore (ISO-8601), ou les deux. Utilisez
limit / offset pour parcourir les clés découvertes par pages.
Paramètres
object
requis
Renvoie
Promise<Réponse<{ attributes?: object[]; has_more?: boolean; limit?: number; offset?: number; }>>
Exemple
getAgents()
getAgents(Répertorie les agents avec des statistiques agrégées.options?):Promise<Réponse<GetAgentsResult>>
Paramètres
GetAgentsOptions = {}
Voir
GetAgentsOptions.Renvoie
Promise<Réponse<GetAgentsResult>>
Exemple
getAgentSpans()
getAgentSpans(Interroge les spans d’agent, éventuellement filtrés par nom d’agent et/ou par une expression de requête de type Mongo.options) :Promise<Réponse<GetAgentSpansResult>>
Paramètres
GetAgentSpansOptions
requis
Voir
GetAgentSpansOptions.Renvoie
Promise<Réponse<GetAgentSpansResult>>
Exemples
getAgentSpanStats()
getAgentSpanStats(Agrégations sur les spans d’agent du projet, renvoyées sous forme de lignes et de métadonnées de colonnes adaptées aux visualisations de séries temporelles ou par compartiments.options) :Promise<Réponse<{bucket_type?:"number"|"time";columns?:object[];end:string;granularity?:number|null;rows?:Record<string,string|number|boolean|null>[];start:string;timezone:string; }>>
start (requis) et end définissent la fenêtre temporelle. Chaque entrée de
metrics indique un champ à extraire et la façon de l’agréger (sum,
avg, count, percentiles, etc.). Transmettez granularity (en secondes) pour
regrouper les lignes par intervalle temporel, ou groupBy pour ventiler les résultats par agent /
provider / model / etc. query filtre les spans sous-jacents avant
l’agrégation.
Paramètres
object
requis
Renvoie
Promise<Réponse<{ bucket_type?: "number" | "time"; columns?: object[]; end: string; granularity?: number | null; rows?: Record<string, string | number | boolean | null>[]; start: string; timezone: string; }>>
Exemple
getAgentTurn()
getAgentTurn(Obtient les données (y compris les messages) d’un seul tour de conversation (par traceId).options) :Promise<Réponse<{agent_name?:string|null;agent_version?:string|null;feedback?:Record<string,any>[] |null;messages?:object[];provider?:string|null;root_span_name?:string|null;status_code?:"UNSET"|"OK"|"ERROR"|null;total_cost_usd?:number|null;total_duration_ms?:number|null;trace_id:string; }>>
Paramètres
GetAgentTurnOptions
requis
Voir
GetAgentTurnOptions.Renvoie
Promise<Réponse<{ agent_name?: string | null; agent_version?: string | null; feedback?: Record<string, any>[] | null; messages?: object[]; provider?: string | null; root_span_name?: string | null; status_code?: "UNSET" | "OK" | "ERROR" | null; total_cost_usd?: number | null; total_duration_ms?: number | null; trace_id: string; }>>
Exemple
getAgentTurns()
getAgentTurns(Obtenir les données (y compris les messages) de nombreux tours de conversation (par conversationId).options):Promise<Réponse<GetAgentTurnsResult>>
Paramètres
GetAgentTurnsOptions
requis
Voir
GetAgentTurnsOptions.Renvoie
Promise<Réponse<GetAgentTurnsResult>>
Exemple
getAgentVersions()
getAgentVersions(Liste les versions d’un agent donné.options) :Promise<Réponse<GetAgentVersionsResult>>
Paramètres
GetAgentVersionsOptions
requis
Voir
GetAgentVersionsOptions.Renvoie
Promise<Réponse<GetAgentVersionsResult>>
Exemple
getCall()
getCall(callId,includeCosts?):Promise<{attributes:Record<string,any>;deleted_at?:string|null;display_name?:string|null;ended_at?:string|null;exception?:string|null;expire_at?:string|null;id:string;inputs:Record<string,any>;op_name:string;output?:null;parent_id?:string|null;project_id:string;started_at:string;storage_size_bytes?:number|null;summary?:Record<string,any>;thread_id?:string|null;total_storage_size_bytes?:number|null;trace_id:string;turn_id?:string|null;wb_run_id?:string|null;wb_run_step?:number|null;wb_run_step_end?:number|null;wb_user_id?:string|null;wb_username?:string|null;setDisplayName:Promise<void>; }>
Paramètres
string
requis
boolean = false
Renvoie
Promise<{ attributes: Record<string, any>; deleted_at?: string | null; display_name?: string | null; ended_at?: string | null; exception?: string | null; expire_at?: string | null; id: string; inputs: Record<string, any>; op_name: string; output?: null; parent_id?: string | null; project_id: string; started_at: string; storage_size_bytes?: number | null; summary?: Record<string, any>; thread_id?: string | null; total_storage_size_bytes?: number | null; trace_id: string; turn_id?: string | null; wb_run_id?: string | null; wb_run_step?: number | null; wb_run_step_end?: number | null; wb_user_id?: string | null; wb_username?: string | null; setDisplayName: Promise<void>; }>
getCalls()
Signature de l’appel
getCalls(options?):Promise<objet[]>
Paramètres
GetCallsOptions
Voir
GetCallsOptions.Renvoie
Promise<objet[]>
Signature de l’appel
getCalls(options?,includeCosts?,limit?):Promise<objet[]>
Paramètres
CallsFilter
Voir
CallsFilter.boolean
number
Renvoie
Promise<objet[]>
getCallsIterator()
Signature de l’appel
getCallsIterator(options?,includeCosts?,limit?):AsyncIterableIterator<CallSchema>
Paramètres
CallsFilter
Voir
CallsFilter.boolean
number
Renvoie
AsyncIterableIterator<CallSchema>
Signature d’appel
getCallsIterator(options?):AsyncIterableIterator<CallSchema>
Paramètres
GetCallsOptions
Voir
GetCallsOptions.Renvoie
AsyncIterableIterator<CallSchema>
getCallStack()
getCallStack(): CallStack
Renvoie
CallStack
getCurrentAttributes()
getCurrentAttributes():Record<string,any>
Renvoie
Record<string, any>
linkPromptToRegistry()
linkPromptToRegistry(Associe une version publiée d’un prompt à un portefeuille de registre.prompt,options):Promise<{version_index:number|null; }>
Paramètres
objet
requis
Renvoie
Promise<{ version_index: number | null; }>
pendingCallCount()
pendingCallCount(): number
Appels mis en mémoire tampon côté client, mais pas encore transmis au serveur.
Renvoie
number
publish()
publish(obj,objId?):Promise<ObjectRef>
Paramètres
any
requis
string
Renvoie
Promise<ObjectRef>
pushNewCall()
pushNewCall() : objet
Renvoie
objet
objet
requis
currentCall.callId
callId: string
currentCall.childSummary
childSummary:Record<string,any>
currentCall.displayName
optionaldisplayName:string
currentCall.opName
optionalopName:string
currentCall.traceId
traceId: string
CallStack
requis
objet
parentCall.callId
callId: string
parentCall.childSummary
childSummary:Record<string,any>
parentCall.displayName
optionaldisplayName:string
parentCall.opName
optionalopName:string
parentCall.traceId
traceId: string
registerCustomRuntime()
registerCustomRuntime(Enregistre un environnement d’exécution personnalisé, en remplaçant l’intégralité de sa configuration s’il existe déjà.options) :Promise<Réponse<{api_key_secret:string|null;base_url:string;headers:Record<string,string>;name:string;runtime_ids:objet[]; }>>
Paramètres
RegisterCustomRuntimeOptions
requis
Renvoie
Promise<Réponse<{ api_key_secret: string | null; base_url: string; headers: Record<string, string>; name: string; runtime_ids: object[]; }>>
runWithAttributes()
runWithAttributes<T>(attributes,fn):T
Paramètres de type
Paramètres
Record<string, any>
requis
() => T
requis
Renvoie
T
runWithCallStack()
runWithCallStack<T>(callStack,fn) :T
Paramètres de type
Paramètres
CallStack
requis
() => T
requis
Renvoie
T
saveCallEnd()
saveCallEnd(callEnd) :void
Paramètres
objet & objet
requis
Renvoie
void
saveCallStart()
saveCallStart(callStart,opts?) :void
Paramètres
object
requis
object
Renvoie
void
saveOp()
saveOp(op,objId?):Promise<OpRef>
Paramètres
string
Renvoie
Promise<OpRef>
searchAgents()
searchAgents(Recherche en texte intégral parmi les messages d’agent du projet. Renvoie les résultats regroupés par conversation, avec un aperçu de chaque message correspondant.options) :Promise<Réponse<{results:objet[];total_conversations?:number; }>>
query correspond au terme de recherche en texte intégral. Transmettez une chaîne vide pour récupérer
tous les messages correspondant aux filtres structurés (agentName,
conversationId, traceId) sans effectuer de recherche textuelle. Utilisez limit /
offset pour parcourir les résultats page par page.
Paramètres
objet
requis
Renvoie
Promise<Réponse<{ results: objet[]; total_conversations?: number; }>>
Exemple
serializeAudio()
serializeAudio(Téléverse des octets audio bruts vers le magasin de contenu Weave et renvoie l’espace réservédata,audioType?):Promise<{_type:"CustomWeaveType";files:Record<string,string>;load_op:string;weave_type: {type:string; }; }>
CustomWeaveType pouvant être intégré à une sortie d’appel.
Utilisez cette méthode lorsque vous créez manuellement des sorties d’appel (par ex. via saveCallEnd)
et que le pipeline de sérialisation automatique de finishCall n’est pas utilisé.
Paramètres
Buffer
requis
Données audio brutes (WAV pour une compatibilité optimale avec les navigateurs)
"wav" = DEFAULT_AUDIO_TYPE
Format de fichier — seul ‘wav’ est actuellement pris en charge
Renvoie
Promise<{ _type: "CustomWeaveType"; files: Record<string, string>; load_op: string; weave_type: { type: string; }; }>
updateCall()
updateCall(callId,displayName) :Promise<void>
Paramètres
string
requis
string
requis
Renvoie
Promise<void>
waitForBatchProcessing()
waitForBatchProcessing():Promise<void>
Renvoie
Promise<void>