Skip to content

Commit

Permalink
feat(js): Expose light interface for tracing client (#1266)
Browse files Browse the repository at this point in the history
Allows for interoperability in LangChain when initializing tracer with
clients if different LangSmith versions are resolved:

```ts
import { Client } from "langsmith";
// `@langchain/core` may have a different internal version of `langsmith`
import { LangChainTracer } from "@langchain/core/tracers";

const client = new Client();

const tracer = new LangChainTracer({
  client, // Will type error if resolutions are bad
});
```
  • Loading branch information
jacoblee93 authored Nov 27, 2024
1 parent 3f11b59 commit 6f71cb7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "langsmith",
"version": "0.2.7",
"version": "0.2.8",
"description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
"packageManager": "[email protected]",
"files": [
Expand Down
8 changes: 7 additions & 1 deletion js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ export const DEFAULT_BATCH_SIZE_LIMIT_BYTES = 20_971_520;

const SERVER_INFO_REQUEST_TIMEOUT = 1000;

export class Client {
export class Client implements LangSmithTracingClientInterface {
private apiKey?: string;

private apiUrl: string;
Expand Down Expand Up @@ -4171,3 +4171,9 @@ export class Client {
]);
}
}

export interface LangSmithTracingClientInterface {
createRun: (run: CreateRunParams) => Promise<void>;

updateRun: (runId: string, run: RunUpdate) => Promise<void>;
}
8 changes: 6 additions & 2 deletions js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export { Client, type ClientConfig } from "./client.js";
export {
Client,
type ClientConfig,
type LangSmithTracingClientInterface,
} from "./client.js";

export type {
Dataset,
Expand All @@ -14,4 +18,4 @@ export { RunTree, type RunTreeConfig } from "./run_trees.js";
export { overrideFetchImplementation } from "./singletons/fetch.js";

// Update using yarn bump-version
export const __version__ = "0.2.7";
export const __version__ = "0.2.8";

0 comments on commit 6f71cb7

Please sign in to comment.