{"id":23331431,"url":"https://github.com/marinac-dev/openai","last_synced_at":"2025-04-09T16:16:39.348Z","repository":{"id":153799240,"uuid":"618096999","full_name":"marinac-dev/openai","owner":"marinac-dev","description":"Elixir OpenAi Library with streaming support","archived":false,"fork":false,"pushed_at":"2024-04-16T23:44:33.000Z","size":143,"stargazers_count":8,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T16:16:31.304Z","etag":null,"topics":["elixir","openai","openai-api","streaming"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marinac-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-23T18:42:17.000Z","updated_at":"2023-12-03T08:39:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"2fce0e26-0c29-4e26-a95d-8ee340dc3544","html_url":"https://github.com/marinac-dev/openai","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinac-dev%2Fopenai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinac-dev%2Fopenai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinac-dev%2Fopenai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marinac-dev%2Fopenai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marinac-dev","download_url":"https://codeload.github.com/marinac-dev/openai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065285,"owners_count":21041872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","openai","openai-api","streaming"],"created_at":"2024-12-20T22:37:44.301Z","updated_at":"2025-04-09T16:16:39.320Z","avatar_url":"https://github.com/marinac-dev.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAi\n\nElixir OpenAi client library for with full support for streaming or SSE (Server Side Events).\n\n## Installation\n\nNot available in Hex, but the package can be installed from git\nby adding `openai` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:openai, git: \"git@github.com:marinac-dev/openai.git\", branch: \"master\"},\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) by running `mix docs`.\n\n## Configuration\n\n```elixir\nconfig :openai,\n  api_key: System.get_env(\"OPENAI_API_KEY\"),\n  organization_key: System.get_env(\"OPENAI_ORGANIZATION_KEY\")\n```\n\nIf you want to use retry mechanism, you can configure it like this:\n\n```elixir\nconfig :openai,\n  api_key: System.get_env(\"OPENAI_API_KEY\"),\n  organization_key: System.get_env(\"OPENAI_ORGANIZATION_KEY\"),\n  retry_config: %{\n    retries: 5,\n    delay: 200\n  }\n```\n\n## Usage\n\nOnce configured in your `config.ex` file, you can use the client to call the OpenAi API instantly.\n\n```elixir\nprompt = %{model: \"gpt-3.5-turbo\", messages: [%{role: \"user\", content: \"Hello!\"}], stream: true}\nOpenAi.chat_completion(prompt)\n{:ok, \"Hello! How may I assist you today?\"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarinac-dev%2Fopenai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarinac-dev%2Fopenai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarinac-dev%2Fopenai/lists"}