Skip to content

feat: Add @langchain/baseten provider package#424

Closed
Maahir Sachdev (maahir30) wants to merge 1 commit intomainfrom
baseten-integration
Closed

feat: Add @langchain/baseten provider package#424
Maahir Sachdev (maahir30) wants to merge 1 commit intomainfrom
baseten-integration

Conversation

@maahir30
Copy link
Copy Markdown
Contributor

Adds a new @langchain/baseten package — a LangChain chat model provider for Baseten's OpenAI-compatible inference API. This is a TypeScript port of the official Python langchain-baseten package.

  • Introduces ChatBaseten, extending ChatOpenAI and pointing it at Baseten's https://inference.baseten.co/v1 endpoint
  • Ports TensorRT-LLM streaming fixes from Python: tool-call chunk normalization (normalizeToolCallChunks) and cumulative usage metadata stripping
  • Adds dedicated model URL support (modelUrl) with automatic normalization of /predict, /sync, and /sync/v1 endpoint formats (via normalizeModelUrl)
  • Tags all responses with model_provider: "baseten" in response_metadata and ls_provider: "baseten" for LangSmith tracing
  • Reasoning content (additional_kwargs.reasoning_content) flows through via the parent @langchain/openai completions converters — verified with pass-through tests
  • Defaults streamUsage: true to match the Python package behavior
  • Includes 38 unit tests and 3 integration tests (direct invoke, streaming, createDeepAgent end-to-end)

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 3, 2026

⚠️ No Changeset found

Latest commit: 22aeb49

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

return `${url}/v1`;
}
if (!url.endsWith("/v1")) {
return `${url.replace(/\/+$/, "")}/v1`;

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings with many repetitions of '/'.
This
regular expression
that depends on
library input
may run slow on strings with many repetitions of '/'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants