restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub.
Docs are at OpenaiEx User Guide — openai_ex v0.9.21.
The main user guide is a livebook, so you should be able to run everything without any setup. The user guide is also the test suite. It is run before every version release, so it is always up to date with the library.
Portions of this project were developed with assistance from ChatGPT 3.5 and 4, as well as Claude 3 Opus and Claude 3.5 Sonnet. However, every line of code is human curated (by me
).
All API endpoints and features (as of Mar 16, 2025) are supported, including the most recent Responses API (proposed replacement for Chat Completion).
Configuration of Finch pools and API base url are supported.
There are some differences compared to other elixir openai wrappers.
-
I tried to faithfully mirror the naming/structure of the official python api. For example, content that is already in memory can be uploaded as part of a request, it doesn’t have to be read from a file at a local path.
-
I was developing for a livebook use-case, so I don’t have any config, only environment variables.
-
Streaming API versions, with request cancellation, are supported.
-
The underlying transport is finch, rather than httpoison
-
3rd Party (including local) LLMs with an OpenAI proxy, as well as the Azure OpenAI API, are considered legitimate use cases.
Documentation is still a work in progress. In addition to the user guide, there are also Livebook examples for
-
Streaming Orderbot An example of how to use ChatCompletion streaming in a Chatbot. This is a streaming version of the next Livebook in this list.
-
The Deeplearning.AI Order Bot — openai_ex v0.9.21. This notebook is an elixir / Kino translation of the python notebook in Lesson 8, of Deeplearning.AI’s course ChatGPT Prompt Engineering for Developers.
-
A Completions Bot (Deprecated API) — openai_ex v0.9.21 which can be deployed as a Livebook app. The deployed app displays 2 forms, one for normal completions and another for streaming completions.
The library is developed in a livebook docker image running in a VS code dev container.
Please try it out and let me know what you think. Happy to receive suggestions (and PRs) for improvement, as well as illustrative sample notebooks.
Trending in Announcing
Other Trending Topics
Latest Livebook Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hubertlepicki
FYI, as of 3 days ago, I’ve been using it with some light experiments xD
restlessronin
Wonderful. You must have found it almost at the same time I first published the package
Lots of improvements / changes in the past few days (including switching from
ReqtoTesla)Hope you’re finding it useful. Let me know if you have any comments / suggestions.
dimitarvp
Would you give us the rationale as to why? I am interested to read it.
restlessronin
No deep reason. I liked the Req design a little better, but it doesn’t support multi part form uploads. Tesla does. And some of the API endpoints require it.
dimitarvp
Well, that’s a pretty good reason though. Thanks.
hubertlepicki
FYR, there’s a stand-alone multipart building library that can be used with HTTP clients that don’t have it built in, at least one, I think I used a different one back in the day but can’t find it now:
https://github.com/breakroom/multipart
restlessronin
Thanks @hubertlepicki. It’s good to know, in case there’s a future use-case where people want to plug in a specific client.
restlessronin
I’ve released v0.1.3 with refinements to the Audio API and included an Audio example in the user guide.
darwin67
Would be nice to have additional helpers like LangChain!
Happy to help out if you considering working on it!
hubertlepicki
Yep, and the end result may be better than LangChain as Elixir has great building blocks to things like that.