LangExtract.Provider.OpenAI (LangExtract v0.11.0)

Copy Markdown View Source

OpenAI provider for LLM inference.

Calls the OpenAI Chat Completions API via Req.

:token_limit_key picks the wire key carrying the completion-token cap: :max_completion_tokens (default — openai.com, where reasoning models reject the deprecated key) or :max_tokens for OpenAI-compatible endpoints whose servers only know the deprecated key. Older compat builds (Ollama, LocalAI, llama.cpp) silently drop unknown keys, so the wrong choice there truncates replies at the server's own default length — set token_limit_key: :max_tokens alongside base_url for those. The library option stays :max_tokens either way; only the wire key differs.