> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # LangSmith수출업체 Observability을 위해 추적 데이터를 LangSmith로 보냅니다. ## 건설자 ```typescript new LangSmithExporter(config: LangSmithExporterConfig) ``` ## `LangSmithExporterConfig` ```typescript interface LangSmithExporterConfig extends ClientConfig, BaseExporterConfig { client?: Client projectName?: string } ``` `ClientConfig`(LangSmith SDK 제공)와 `BaseExporterConfig`를 모두 확장합니다. - 에서`BaseExporterConfig`: `logger?: IMastraLogger`, `logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error'` - 에서`ClientConfig`: `apiKey`, `apiUrl`, `callerOptions`, `hideInputs`, `hideOutputs`, 등. ## 행동 양식 ### `exportTracingEvent` ```typescript async exportTracingEvent(event: TracingEvent): Promise ``` 추적 이벤트를 LangSmith로 내보냅니다. ### 플러시 ```typescript async flush(): Promise ``` Force는 내보내기를 종료하지 않고 보류 중인 모든 범위를 LangSmith로 플러시합니다. 런타임이 종료되기 전에 범위를 내보내야 하는 서버리스 환경에 유용합니다. ### 일시 휴업 ```typescript async shutdown(): Promise ``` 모든 활성 범위를 종료하고 추적 맵을 지웁니다. ## 용법 ```typescript import { LangSmithExporter } from '@mastra/langsmith' const exporter = new LangSmithExporter({ apiKey: process.env.LANGSMITH_API_KEY, projectName: 'my-project', // Optional: specify which project to send traces to apiUrl: 'https://api.smith.langchain.com', logLevel: 'info', }) ``` ## 환경변수 | 변수 | 설명 | | -------------------- | ----------------------------------------------- | | `LANGSMITH_API_KEY` | LangSmith API 키 | | `LANGCHAIN_PROJECT` | Trace의 기본 프로젝트 이름(`projectName`을 지정하지 않은 경우 사용) | | `LANGSMITH_BASE_URL` | 자체 호스팅 인스턴스의 API URL | ## 스팬 유형 매핑 | 스팬 유형 | 랭스미스 유형 | | -------------------- | ------- | | `MODEL_GENERATION` | `llm` | | `MODEL_CHUNK` | `llm` | | `TOOL_CALL` | `tool` | | `MCP_TOOL_CALL` | `tool` | | `PROVIDER_TOOL_CALL` | `tool` | | All others | `chain` | ## `withLangsmithMetadata` 추적 옵션에 LangSmith 관련 메타데이터를 추가하는 도우미 기능입니다. ```typescript function withLangsmithMetadata(metadata: LangSmithMetadataInput): TracingOptionsUpdater ``` ### `LangSmithMetadataInput` ### 용법 ```typescript import { buildTracingOptions } from '@mastra/observability' import { withLangsmithMetadata } from '@mastra/langsmith' // Route to a specific project const tracingOptions = buildTracingOptions(withLangsmithMetadata({ projectName: 'my-project' })) // Set multiple fields const tracingOptions = buildTracingOptions( withLangsmithMetadata({ projectName: 'my-project', sessionId: 'user-123', }), ) ```