LangSmith is a powerful development platform for LLM applications that provides valuable insights, debugging tools, and performance monitoring. Integrating LangSmith with RAGChat can significantly enhance your development workflow and application quality.

For Upstash Models
import { RAGChat, upstash } from "@upstash/rag-chat";

const ragChat = new RAGChat({
  model: upstash("meta-llama/Meta-Llama-3-8B-Instruct", {
    apiKey: process.env.QSTASH_TOKEN,
    analytics: { name: "langsmith", token: process.env.LANGCHAIN_API_KEY },
  }),
});
For Custom Models (e.g., Meta-Llama)
import { RAGChat, custom } from "@upstash/rag-chat";

const ragChat = new RAGChat({
  model: custom("meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo", {
    apiKey: "xxx",
    baseUrl: "https://api.together.xyz",
    analytics: { name: "langsmith", token: process.env.LANGCHAIN_API_KEY! },
  }),
});
For OpenAI Models
import { RAGChat, openai } from "@upstash/rag-chat";

const ragChat = new RAGChat({
  model: openai("gpt-3.5-turbo", {
    apiKey: process.env.OPENAI_API_KEY,
    analytics: { name: "langsmith", token: process.env.LANGCHAIN_API_KEY },
  }),
});