jsonfirst-langchain
v1.0.0
Published
JSONFIRST intent layer for LangChain — add structured JSON intent governance to your LangChain AI pipelines
Maintainers
Readme
jsonfirst-langchain
LangChain agents break on ambiguous input.
JSONFIRST adds a structured JSON intent layer to your LangChain pipeline so agents execute reliably.
Parse → Govern → Execute.
JSONFIRST helps build reliable AI agents by converting natural language into structured JSON intent.
User input
↓
JSONFIRST (structured JDON)
↓
LangChain router
↓
Tool / Chain executionQuick Example
const { asLangChainTool } = require('jsonfirst-langchain');
// Drop JSONFIRST as a LangChain tool
const tools = [
asLangChainTool(process.env.JSONFIRST_API_KEY),
// ... your other tools
];
// Your agent now gets structured JDON before acting
const agent = await initializeAgentExecutorWithOptions(tools, llm, {
agentType: 'zero-shot-react-description'
});Or use it directly in a chain:
const { parseIntent } = require('jsonfirst-langchain');
const jdon = await parseIntent("book a meeting with Alice tomorrow", process.env.JSONFIRST_API_KEY);
// { action: { normalized: "book" }, object: { type: "meeting" }, confidence: 0.96 }
// Route to the right LangChain chain based on jdon.action.normalizedInstallation
npm install jsonfirst-langchainGet your API key at jsonfirst.com → Dashboard → API Console.
API
const { parseIntent, asLangChainTool } = require('jsonfirst-langchain');| Function | Description |
|---|---|
| parseIntent(text, apiKey, opts) | Returns structured JDON for any input |
| asLangChainTool(apiKey, opts) | Returns a LangChain-compatible tool definition |
Links
License
MIT © JSONFIRST
