hectorperez
Package config in Livebook notebook
Hi!
I was going to play with the package openai [1] in a livebook notebook.
In the setup I added:
Mix.install([
{:openai, "~> 0.1.1"}
])
However, I don’t know how/where to add the config (API key):
use Mix.Config
config :openai,
api_key: "your-api-key",
organization_key: "your-organization-key
Where should I place the package config (API key) so I can use it in a livebook notebook?
Thanks!
[1] GitHub - mgallo/openai.ex: community-maintained OpenAI API Wrapper written in Elixir.
Marked As Solved
LostKobrakai
Mix — Mix v1.13.4 see the second example
8
Also Liked
hectorperez
I missed that, thank you @LostKobrakai!
As a reference, I added this and it worked:
Mix.install(
[{:openai, "~> 0.1.1"}],
config: [
openai: [
api_key: "...",
organisation_key: "...",
]
]
)
8
Anko
To answer my own question ![]()
Mix.install([
{:snap, "~> 0.9.0"},
{:kino, "~> 0.12.3"},
{:finch, "~> 0.18.0"}
])
defmodule Elastic do
use Snap.Cluster, otp_app: :snap
end
Kino.start_child!({Elastic, [url: "http://elastic.local:9200"]})
Snap.Search.search(Elastic, "products", %{query: %{match_all: %{}}})
1
Popular in Questions
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
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Hi,
is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”:
14:57:30.512 [warn] ...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
Hey guys.
I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
The Elixir Typespec docs show the following syntax for keyword lists in typespecs:
# ...
| [key: type] # keyword lis...
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project.
Baby step #1 is extracting the number ...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Other popular topics
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I'm writing a test for one of t...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
New







