restlessronin

restlessronin

Openai_ex - OpenAI API client library

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.

Changelog

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 :innocent:).

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

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.

152 10167 134

Most Liked

restlessronin

restlessronin

I have just published v0.4.0 with all the new and updated API features announced at the OpenAI DevDay.

In particular the beta Assistants API is implemented, although examples have not as yet made it into the user guide and the documentation is incomplete in places. I hope to have some examples soon, and perhaps more complete documentation as the beta stabilizes.

In addition the deprecated ‘function’ calls parameters in the chat completion api have been replaced with the new ‘tool’ based parameters (shoutout to @TomBers for doing that and helping out with the documentation and testing, and generally being on the ball).

Enjoy playing with the new functionality!

restlessronin

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.

hubertlepicki

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

Where Next?

Popular in Announcing Top

danschultzer
In short Plug n’ play OAuth 2.0 provider library. Just set up a resource owner schema with Ecto (your user schema), install the dependen...
New
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
ostinelli
Let’s write a database! Well not really, but I think it’s a little sad that there doesn’t seem to be a simple in-memory distributed KV da...
New
deadtrickster
I’ve just released stable versions of my Prometheus Elixir libs: Elixir client [docs]; Ecto collector [docs]; Plugs instrumenter/Export...
New
kip
Image is an image processing library for Elixir. It is based upon the fabulous vix library that provides a libvips wrapper for Elixir. I...
622 18474 194
New
Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
Azolo
Hey everyone, I just released WebSockex which is a Elixir WebSocket client. WebSockex strives to work as a OTP special process, be RFC6...
New
fuelen
Hey folks! Want to present a toolkit for writing command-line user interfaces. It provides a convenient interface for colorizing text...
New
benlime
LiveMotion enables high performance animations declared on the server and run on the client. As a follow up to my previous thread A libr...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36128 110
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New

We're in Beta

About us Mission Statement