npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@latchway/langchain

v1.1.0

Published

Feature-bound Latchway transport adapter for LangChain.js OpenAI integrations

Readme

@latchway/langchain

The LangChain.js adapter configures ChatOpenAI and OpenAIEmbeddings through their underlying OpenAI client options. It does not introduce chains, agents, graphs, memory, retrieval, or tool execution.

import { createLatchwayChatOpenAI } from "@latchway/langchain";

const model = createLatchwayChatOpenAI({
  latchway,
  feature: "habit-assistant",
});

const message = await model.invoke("Summarize today");

The generated OpenAI-compatible model value is latchway; it is not a physical model selection. Streaming, batching, tools, structured output, cancellation and callbacks remain LangChain behavior over the authenticated transport. As of 1.1.0, chat and embeddings default to zero framework retries; explicitly opt in with maxRetries only when your dispatch/billing policy permits. Latchway correlation IDs are mirrored to the underlying OpenAI client's conventional request-ID header without buffering the response.

Stateless Responses (1.1.0)

import {
  createLatchwayResponsesModel, bindLatchwayTools, toLatchwayReplayMessage,
} from '@latchway/langchain';

const model = createLatchwayResponsesModel({
  latchway,
  feature: 'assistant', // gateway 1.0.2+, configured openai_responses feature
  reasoning: {effort: 'none'}, // only if the server-selected model supports it
  chatOptions: {maxTokens: 1024},
});
const modelWithTools = bindLatchwayTools(model, [weatherTool]);
const answer = await modelWithTools.invoke(messages, {signal});
messages.push(toLatchwayReplayMessage(answer));

Omit reasoning for routes that do not accept it. The adapter cannot infer capabilities from the server-owned model alias. This opt-in factory selects the Responses API with store:false and local history, disables stored-response reuse, and rejects include, previous_response_id, conversation and conflicting storage/reasoning kwargs. It does not promise provider-wide zero retention. Existing createLatchwayChatOpenAI still defaults to Chat Completions.

bindLatchwayTools wraps ordinary LangChain bindTools with strict:true and parallel_tool_calls:false. These are overridable boolean defaults, not a tool executor. Tools need strict-compatible schemas; callers own validation, allowlists, timeouts, loop limits, cancellation and correlated ToolMessages.

toLatchwayReplayMessage accepts a completed AIMessage or fully aggregated AIMessageChunk. It copies local text/function calls, preserves tool-call IDs, and removes provider item IDs and observational metadata. Keep the original for usage/callback information. Unsupported non-text/opaque reasoning/refusal, invalid calls and duplicate/missing call IDs throw rather than silently losing context. Partial/failed stream chunks must not enter conversation history.

Use ordinary model.stream(messages, {signal}) and model.withStructuredOutput(schema, {method:'jsonSchema', strict:true}) when the configured gateway route/model supports the schema. No chains, memory, tools, agents or persistence are created by the adapter.

React Native

Install npm packages, not repository links:

npm install --save-exact @latchway/[email protected] @latchway/[email protected] \
  @latchway/[email protected] @langchain/[email protected] @langchain/[email protected] [email protected]

For React Native 0.82 / New Architecture, put this first in index.js:

import '@latchway/react-native/polyfills';

In babel.config.js:

const {withLatchwayBabel} = require('@latchway/react-native/babel');
module.exports = withLatchwayBabel({
  presets: ['module:@react-native/babel-preset'],
});

Use standard Metro and pass the React Native LatchwayClient directly as latchway. Rebuild native hosts after installation. Authentication, signing, attestation and credentials remain native; the adapter never accepts a provider key. Native framework attribution remains react-native-fetch.

See the complete React Native guide and npm-only LatchwayChat example for Firebase authentication, weather tools, streaming and device-evidence limits. The supported dependency versions are intentionally exact; other versions are not implied by these tests. LangChain reference.