langchain-hs-openai: OpenAI provider and embeddings for langchain-hs

[ ai, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

OpenAI ChatModel provider, streaming support, structured output, and text embeddings integration for langchain-hs. Compatible with OpenAI and OpenAI-compatible endpoints (OpenRouter, Fireworks, Together AI).


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.6.0
Change log CHANGELOG.md
Dependencies aeson (>=2.0 && <3), async (>=2.2 && <2.3), base (>=4.17 && <5), bytestring (>=0.10 && <0.13), conduit (>=1.3 && <1.4), containers (>=0.6 && <0.9), http-client (>=0.7 && <0.8), http-client-tls (>=0.3 && <0.5), http-conduit (>=2 && <3), http-types (>=0.11 && <0.13), langchain-hs-core (>=0.0.6 && <0.0.7), mtl (>=2.2 && <2.4), openai (>=2.2.1 && <3), servant (>=0.19 && <0.21), servant-client (>=0.19 && <0.21), servant-client-core (>=0.19 && <0.21), servant-conduit (>=0.15 && <0.17), servant-event-stream (>=0.4 && <0.5), text (>=1.2 && <3), transformers (>=0.5 && <0.7), vector (>=0.12 && <0.14) [details]
Tested with ghc ==9.12.4, ghc ==9.10.3, ghc ==9.8.4
License MIT
Copyright 2025-2026 Tushar Adhatrao
Author Tushar Adhatrao
Maintainer tusharadhatrao@gmail.com
Uploaded by tusharad at 2026-10-14T21:34:06Z
Category AI
Home page https://github.com/tusharad/langchain-hs#readme
Bug tracker https://github.com/tusharad/langchain-hs/issues
Source repo head: git clone https://github.com/tusharad/langchain-hs
Distributions
Downloads 3 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for langchain-hs-openai-0.0.6.0

[back to package description]

langchain-hs-openai

OpenAI ChatModel provider and embeddings for langchain-hs.

Supports OpenAI and any OpenAI-compatible endpoint (OpenRouter, Fireworks, Together AI). Does not depend on Ollama or Gemini packages.

Installation

# stack.yaml extra-deps
- langchain-hs-openai-0.0.6.0
# package.yaml / .cabal
dependencies:
  - langchain-hs-openai

Usage

import Langchain.Provider.OpenAI
import Control.Monad.Except (runExceptT)

main :: IO ()
main = do
  let model = newOpenAI "sk-..." "gpt-4o"
  res <- runExceptT $ invoke model [userMessage "Hello"] Nothing
  print res