Skip to main content

Migrating from LangChain OutputFixingParser

OutputFixingParser works but has two problems: latency and retries. Shim fixes both.

The Problems

1. Latency

OutputFixingParser waits for the full LLM output before attempting repair. This adds 2-5 seconds of delay.

2. Retries are Expensive

OutputFixingParser sends broken JSON to another LLM call:
Cost: 1,000 failed parses/day = $30/day in retry costs.

Migration Path

Before: LangChain

After: Shim


Benefits


With Schema Validation

Before: LangChain (Pydantic)

After: Shim (JSON Schema)


Streaming Support

Before: No Streaming

LangChain parsers don’t support streaming. Must wait for full output.

After: Shim Streaming


Using the TypeScript SDK

For Node.js/TypeScript projects:

Cost Comparison

OutputFixingParser

Shim Pro Tier

Savings: OutputFixingParser is cheaper at low volume, but Shim is faster and more reliable. Break-even: ~50K repairs/month.

Confidence Scoring

Shim adds confidence levels that LangChain doesn’t provide:

Error Handling

Before: Exceptions

After: Structured Errors


Migration Checklist

  • Sign up at console.shim.so/signup
  • Get API key from console
  • Install shim-sdk (if using TypeScript)
  • Replace OutputFixingParser with Shim API call
  • Add schema validation (optional)
  • Implement confidence-based handling
  • Add structured error handling
  • Test with production traffic
  • Remove LangChain parser dependencies

Hybrid Approach

Keep LangChain, add Shim as a repair layer:

FAQ

Can I use Shim with LangChain?

Yes. Use Shim as a post-processing step after LLM output.

Do I need to remove LangChain?

No. Shim complements LangChain. Replace only the parser.

What about LCEL (LangChain Expression Language)?

Shim works with LCEL. Add it as a final step in the chain.

Does Shim support Pydantic?

Shim uses JSON Schema. Convert Pydantic models with model.model_json_schema().

Can I use OutputFixingParser as a fallback?

Yes, but Shim is faster and cheaper. Fallback not needed.

Next Steps

Quick Start

Get your first repair working

Schema Validation

Add JSON Schema validation

TypeScript SDK

Use the official SDK

Confidence Levels

Understand confidence scoring