vercel.d.ts 951 B

123456789101112131415161718192021222324252627282930
  1. import type { RunTreeConfig } from "../index.js";
  2. /**
  3. * Wrap a Vercel AI SDK model, enabling automatic LangSmith tracing.
  4. * After wrapping a model, you can use it with the Vercel AI SDK Core
  5. * methods as normal.
  6. *
  7. * @example
  8. * ```ts
  9. * import { anthropic } from "@ai-sdk/anthropic";
  10. * import { streamText } from "ai";
  11. * import { wrapAISDKModel } from "langsmith/wrappers/vercel";
  12. *
  13. * const anthropicModel = anthropic("claude-3-haiku-20240307");
  14. *
  15. * const modelWithTracing = wrapAISDKModel(anthropicModel);
  16. *
  17. * const { textStream } = await streamText({
  18. * model: modelWithTracing,
  19. * prompt: "Write a vegetarian lasagna recipe for 4 people.",
  20. * });
  21. *
  22. * for await (const chunk of textStream) {
  23. * console.log(chunk);
  24. * }
  25. * ```
  26. * @param model An AI SDK model instance.
  27. * @param options LangSmith options.
  28. * @returns
  29. */
  30. export declare const wrapAISDKModel: <T extends object>(model: T, options?: Partial<RunTreeConfig>) => T;