메인 콘텐츠로 건너뛰기
weave / WeaveClient

목차

생성자

속성

메서드

생성자

생성자

new WeaveClient(«destructured»): WeaveClient

매개변수

이름유형
«destructured»객체
› projectIdstring
› settings?Partial<Settings>
› traceServerApiApi<any>

반환값

WeaveClient

정의된 위치

src/weaveClient.ts:459

속성

projectId

projectId: string

정의된 위치

src/weaveClient.ts:456

settings

settings: Settings

정의된 위치

src/weaveClient.ts:457

traceServerApi

traceServerApi: Api<any>

정의된 위치

src/weaveClient.ts:455

메서드

addScore

addScore(predictCallId, scorerCallId, runnableRefUri, scorerOutput): Promise<string> call에 scorer 결과(예: scorer 출력)를 추가합니다. 명령형 평가에서 scorer 결과를 predict call에 연결할 때 사용됩니다.

매개변수

이름유형설명
predictCallIdstring피드백을 연결할 predict call의 ID
scorerCallIdstring피드백을 생성한 scorer call의 ID
runnableRefUristringscorer의 URI(Op 또는 Object ref)
scorerOutputanyscorer의 출력값

반환값

Promise<string>

정의된 위치

src/weaveClient.ts:1727

createCall

createCall(internalCall, opRef, params, parameterNames, thisArg, currentCall, parentCall, startTime, displayName?, attributes?): Promise<void>

매개변수

이름유형
internalCallInternalCall
opRefany
paramsany[]
parameterNamesParameterNamesOption
thisArgany
currentCallCallStackEntry
parentCallundefinedCallStackEntry
startTimeDate
displayName?string
attributes?Record<string, any>

반환값

Promise<void>

정의된 위치

src/weaveClient.ts:1570

finishCall

finishCall(call, result, currentCall, parentCall, summarize, endTime, startCallPromise): Promise<void>

매개변수

이름유형
callInternalCall
resultany
currentCallCallStackEntry
parentCallundefinedCallStackEntry
summarizeundefined(result: any) => Record<string, any>
endTimeDate
startCallPromisePromise<void>

반환값

Promise<void>

정의된 위치

src/weaveClient.ts:1630

finishCallWithException

finishCallWithException(call, error, currentCall, parentCall, endTime, startCallPromise): Promise<void>

매개변수

이름유형
callInternalCall
errorany
currentCallCallStackEntry
parentCallundefinedCallStackEntry
endTimeDate
startCallPromisePromise<void>

반환값

Promise<void>

정의된 위치

src/weaveClient.ts:1672

get

get(ref): Promise<any>

매개변수

이름유형
refObjectRef

반환값

Promise<any>

정의된 위치

src/weaveClient.ts:1025

getAgentCustomAttributes

getAgentCustomAttributes(options): Promise<Response<GetAgentCustomAttributesResult>> 프로젝트의 에이전트 span에서 관찰된 유형 지정 맞춤형 속성 키를 조회합니다. 각 결과 행은 (source, key, value_type) 트리플 하나와 해당 값을 가진 span 수로 구성되며, spans query/group/stats API는 이 정보를 사용해 맞춤형 속성을 참조합니다. 고려할 span을 필터링하려면 query(구조화된 span 필터), startedAfter / startedBefore(ISO-8601), 또는 둘 다를 전달하세요. 발견된 키를 페이지별로 보려면 limit / offset을 사용하세요.

매개변수

이름유형
optionsGetAgentCustomAttributesOptions

반환값

Promise<Response<GetAgentCustomAttributesResult>> 예시
const  = await weave.init('entity/project');
const  = await .getAgentCustomAttributes({
  : {
    : {
      : [{: 'agent_name'}, {: 'my-agent'}],
    },
  },
  : '2026-06-15T00:00:00Z',
  : 200,
});

for (const  of .data.attributes ?? []) {
  .(`${.source}.${.key} (${.value_type}): ${.span_count}`);
}

정의된 위치

src/weaveClient.ts:772

getAgentSpanStats

getAgentSpanStats(options): Promise<Response<GetAgentSpanStatsResult>> 프로젝트의 에이전트 spans를 집계하며, 시계열 / 버킷 기반 시각화에 적합한 행 + 열 메타데이터 형태로 반환합니다. start(필수)와 end는 시간 범위를 정의합니다. metrics의 각 항목은 추출할 필드와 집계 방식(sum, avg, count, 백분위수 등)을 지정합니다. granularity(초)를 전달하면 행을 시간 기준으로 버킷화하고, groupBy를 전달하면 결과를 에이전트 / 공급자 / 모델 / 기타 기준별로 나눌 수 있습니다. query는 집계 전에 기본 spans를 필터링합니다.

매개변수

이름유형
optionsGetAgentSpanStatsOptions

반환값

Promise<Response<GetAgentSpanStatsResult>> 예시
const  = await weave.init('entity/project');
const  = await .getAgentSpanStats({
  : '2026-06-10T00:00:00Z',
  : '2026-06-23T00:00:00Z',
  : 86400, // 하루에 한 행
  : [
    {
      : 'total_input_tokens',
      : 'number',
      : ['sum'],
      : {: 'field', : 'input_tokens'},
    },
  ],
  : [{: 'agent_name'}],
});

for (const  of .data.rows ?? []) {
  .(.started_at_bucket, .agent_name, .total_input_tokens);
}

정의된 위치

src/weaveClient.ts:621

getAgentSpans

getAgentSpans(options): Promise<Response<GetAgentSpansResult>> 에이전트 이름 및/또는 Mongo 스타일 쿼리 표현식으로 선택적으로 필터링하여 에이전트 span을 조회합니다.

매개변수

이름유형
optionsGetAgentSpansOptions

반환값

Promise<Response<GetAgentSpansResult>> 예시
const  = await weave.init('entity/project');
const  = await .getAgentSpans({: 'my-agent', : 20});

for (const  of .data.spans) {
  .(.span_id, .span_name, .input_tokens);
}
예시
const  = await weave.init('entity/project');

const  = await .getAgentSpans({
  : 'my-agent',
  : {
    : {: [{: 'input_tokens'}, {: 1000}]},
  },
});

for (const  of .data.spans) {
  .(.span_id, .span_name, .input_tokens);
}

정의된 위치

src/weaveClient.ts:566

getAgentTurn

getAgentTurn(options): Promise<Response<AgentTraceChatRes>> traceId를 기준으로 단일 턴의 데이터(메시지 포함)를 조회합니다.

매개변수

이름유형
optionsGetAgentTurnOptions

반환값

Promise<Response<AgentTraceChatRes>> 예시
const  = await weave.init('entity/project');
const  = await .getAgentTurn({
  : '01997b8a-2c89-7c4d-9d0e-2f7e5b9a1b2c',
  : true,
});

.(.data.root_span_name, .data.total_duration_ms);

for (const  of .data.messages ?? []) {
  if (.user_message) .('user:', .user_message);
  if (.assistant_message) .('assistant:', .assistant_message);
}

정의된 위치

src/weaveClient.ts:655

getAgentTurns

getAgentTurns(options): Promise<Response<GetAgentTurnsResult>> conversationId를 기준으로 여러 턴의 데이터(메시지 포함)를 조회합니다.

매개변수

이름유형
optionsGetAgentTurnsOptions

반환값

Promise<Response<GetAgentTurnsResult>> 예시
const  = await weave.init('entity/project');
const  = await .getAgentTurns({
  : 'trace_c50312356de3487fa90e381c9399b5b4',
  : 20,
  : true,
});

for (const  of .data.turns ?? []) {
  .(.trace_id, .root_span_name);
  for (const  of .messages ?? []) {
    if (.user_message) .('user:', .user_message);
    if (.assistant_message) .('assistant:', .assistant_message);
  }
}

.(`total turns: ${.data.total_turns}, has more: ${.data.has_more}`);

정의된 위치

src/weaveClient.ts:688

getAgentVersions

getAgentVersions(options): Promise<Response<GetAgentVersionsResult>> 특정 에이전트의 버전 목록을 조회합니다.

매개변수

이름유형
optionsGetAgentVersionsOptions

반환값

Promise<Response<GetAgentVersionsResult>> 예시
const  = await weave.init('entity/project');
const  = await .getAgentVersions({: 'my-agent', : 20});

for (const  of .data.versions) {
  .(.agent_version, .total_input_tokens);
}

.(`total count: ${.data.total_count}`)

정의된 위치

src/weaveClient.ts:522

getAgents

getAgents(options?): Promise<Response<GetAgentsResult>> 집계 통계가 포함된 에이전트 목록을 조회합니다.

매개변수

이름유형
optionsGetAgentsOptions

반환값

Promise<Response<GetAgentsResult>> 예시
const  = await weave.init('entity/project');
const  = await .getAgents({: 20});

for (const  of .data.agents) {
  .(.agent_name, .total_input_tokens);
}

.(`total count: ${.data.total_count}`)

정의된 위치

src/weaveClient.ts:488

getCall

getCall(callId, includeCosts?): Promise<Call>

매개변수

이름유형기본값
callIdstringundefined
includeCostsbooleanfalse

반환값

Promise<Call>

정의된 위치

src/weaveClient.ts:902

getCallStack

getCallStack(): CallStack

반환값

CallStack

정의된 위치

src/weaveClient.ts:1482

getCalls

getCalls(options?): Promise<Call[]>

매개변수

이름유형
options?GetCallsOptions

반환값

Promise<Call[]>

정의된 위치

src/weaveClient.ts:935 getCalls(options?, includeCosts?, limit?): Promise<Call[]>

매개변수

이름유형
options?CallsFilter
includeCosts?boolean
limit?number

반환값

Promise<Call[]>

정의된 위치

src/weaveClient.ts:936

getCallsIterator

getCallsIterator(options?, includeCosts?, limit?): AsyncIterableIterator<CallSchema, any, any>

매개변수

이름유형
options?CallsFilter
includeCosts?boolean
limit?number

반환값

AsyncIterableIterator<CallSchema, any, any>

정의된 위치

src/weaveClient.ts:957 getCallsIterator(options?): AsyncIterableIterator<CallSchema, any, any>

매개변수

이름유형
options?GetCallsOptions

반환값

AsyncIterableIterator<CallSchema, any, any>

정의된 위치

src/weaveClient.ts:962

getCurrentAttributes

getCurrentAttributes(): Record<string, any>

반환값

Record<string, any>

정의된 위치

src/weaveClient.ts:1486

linkPromptToRegistry

linkPromptToRegistry(prompt, options): Promise<LinkAssetToRegistryRes> 게시된 프롬프트 버전을 레지스트리 포트폴리오에 연결합니다.

매개변수

이름유형
promptRegistryLinkable
optionsLinkPromptToRegistryOptions

반환값

Promise<LinkAssetToRegistryRes>

정의된 위치

src/weaveClient.ts:1181

publish

publish(obj, objId?): Promise<ObjectRef>

매개변수

이름유형
objany
objId?string

반환값

Promise<ObjectRef>

정의된 위치

src/weaveClient.ts:890

pushNewCall

pushNewCall(): 객체

반환값

객체
이름유형
currentCallCallStackEntry
newStackCallStack
parentCall?CallStackEntry

정의된 위치

src/weaveClient.ts:1490

runWithAttributes

runWithAttributes<T>(attributes, fn): T

유형 매개변수

이름
T

매개변수

이름유형
attributesRecord<string, any>
fn() => T

반환값

T

정의된 위치

src/weaveClient.ts:1498

runWithCallStack

runWithCallStack<T>(callStack, fn): T

유형 매개변수

이름
T

매개변수

이름유형
callStackCallStack
fn() => T

반환값

T

정의된 위치

src/weaveClient.ts:1494

saveCallEnd

saveCallEnd(callEnd): void

파라미터

이름유형
callEndEndedCallSchemaForInsert

반환값

void

정의된 위치

src/weaveClient.ts:1477

saveCallStart

saveCallStart(callStart): void

파라미터

이름유형
callStartStartedCallSchemaForInsert

반환값

void

정의된 위치

src/weaveClient.ts:1472

saveOp

saveOp(op, objId?): Promise<OpRef>

매개변수

이름유형
opOp<(…args: any[]) => any>
objId?string

반환값

Promise<OpRef>

정의된 위치

src/weaveClient.ts:1537

searchAgents

searchAgents(options): Promise<Response<SearchAgentsResult>> 프로젝트 내 에이전트 메시지 전체에서 전문 검색을 수행합니다. 일치 항목은 대화별로 그룹화되어 반환되며, 각 일치 메시지의 미리보기도 함께 제공됩니다. query는 전문 검색어입니다. 빈 string을 전달하면 텍스트 일치 없이 구조화된 필터 (agentName, conversationId, traceId)에 일치하는 모든 메시지를 가져옵니다. limit / offset을 사용해 결과를 페이지별로 확인하세요.

매개변수

이름유형
optionsSearchAgentsOptions

반환값

Promise<Response<SearchAgentsResult>> 예시
const  = await weave.init('entity/project');
const  = await .searchAgents({
  : 'Liverpool',
  : 'Assistant',
  : 20,
});

for (const  of .data.results ?? []) {
  .(`${.conversation_id} (${.agent_name})`);
  for (const  of .matched_messages) {
    .(`  [${.role}] ${.content_preview}`);
  }
}

.(`total conversations: ${.data.total_conversations}`);

정의된 위치

src/weaveClient.ts:730

serializeAudio

serializeAudio(data, audioType?): Promise<SerializedFileBlob> 원시 오디오 바이트를 Weave 콘텐츠 저장소에 업로드하고, call 출력에 포함할 수 있는 CustomWeaveType 플레이스홀더를 반환합니다. finishCall의 자동 직렬화 파이프라인을 사용하지 않는 경우 (예: saveCallEnd를 통해) call 출력을 수동으로 구축할 때 사용하세요.

매개변수

이름유형기본값설명
dataBuffer<ArrayBufferLike>undefined원시 오디오 바이트(WAV 형식이 브라우저 호환성에 가장 좋음)
audioType"wav"DEFAULT_AUDIO_TYPE파일 형식 — 현재는 ‘wav’만 지원됩니다

반환값

Promise<SerializedFileBlob>

정의된 위치

src/weaveClient.ts:1424

updateCall

updateCall(callId, displayName): Promise<void>

매개변수

이름유형
callIdstring
displayNamestring

반환값

Promise<void>

정의된 위치

src/weaveClient.ts:1710

waitForBatchProcessing

waitForBatchProcessing(): Promise<void>

반환값

Promise<void>

정의된 위치

src/weaveClient.ts:801