Cleaning up after testing various API calls
Mix.install([
{:openai_ex, "~> 0.8.4"},
{:kino, "~> 0.13.2"}
])
Files cleanup
apikey = System.fetch_env!("LB_OPENAI_API_KEY")
openai = OpenaiEx.new(apikey)
all_files = openai |> OpenaiEx.Files.list!()
Enum.each(all_files["data"], fn file -> OpenaiEx.Files.delete!(openai, file["id"]) end)
OpenaiEx.Files.list!(openai)
Assistants cleanup
all_assistants = OpenaiEx.Beta.Assistants.list!(openai)
Enum.each(all_assistants["data"], fn a -> OpenaiEx.Beta.Assistants.delete!(openai, a["id"]) end)
OpenaiEx.Beta.Assistants.list!(openai)
Vector Stores cleanup
(openai |> OpenaiEx.Beta.VectorStores.list!())["data"]
|> Enum.each(fn vs -> openai |> OpenaiEx.Beta.VectorStores.delete!(vs["id"]) end)
openai |> OpenaiEx.Beta.VectorStores.list!()