From d54ab22d45848b9eeeade0297240c9ab5fd513c9 Mon Sep 17 00:00:00 2001 From: David Snoble <49111966+DavidSnoble@users.noreply.github.com> Date: Wed, 20 Dec 2023 08:47:07 -0700 Subject: [PATCH 1/4] download file content --- lib/openai/files.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/openai/files.ex b/lib/openai/files.ex index 131b10a..a96ddf3 100644 --- a/lib/openai/files.ex +++ b/lib/openai/files.ex @@ -7,6 +7,7 @@ defmodule OpenAI.Files do def url(), do: @files_base_url def url(file_id), do: "#{@files_base_url}/#{file_id}" + def content_url(file_id), do: "#{@files_base_url}/#{file_id}/content" def fetch(config \\ %Config{}) do url() @@ -27,4 +28,9 @@ defmodule OpenAI.Files do url() |> Client.multipart_api_post(file_path, "file", params, config) end + + def download(file_id, config \\ %Config{}) do + content_url(file_id) + |> Client.api_get(config) + end end From 9f8de3f2516c61a7f02b481fc37befbe5d65c428 Mon Sep 17 00:00:00 2001 From: David Snoble <49111966+DavidSnoble@users.noreply.github.com> Date: Wed, 20 Dec 2023 08:54:47 -0700 Subject: [PATCH 2/4] bump version --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 7ff70f7..931f9ec 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule OpenAI.MixProject do def project do [ app: :openai, - version: "0.6.1", + version: "0.6.2", elixir: "~> 1.11", description: description(), start_permanent: Mix.env() == :prod, From 638e83c2844dede24e27445511b8b84cdc2570c4 Mon Sep 17 00:00:00 2001 From: David Snoble <49111966+DavidSnoble@users.noreply.github.com> Date: Wed, 20 Dec 2023 08:58:05 -0700 Subject: [PATCH 3/4] bump dep --- mix.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.lock b/mix.lock index a83ab35..8ba9329 100644 --- a/mix.lock +++ b/mix.lock @@ -19,6 +19,6 @@ "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, } From b545c0ff88cf1b402800b0729749a1ef5807c749 Mon Sep 17 00:00:00 2001 From: David Snoble <49111966+DavidSnoble@users.noreply.github.com> Date: Mon, 27 May 2024 14:39:18 -0600 Subject: [PATCH 4/4] update assistants url --- lib/openai/assistants/files.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/openai/assistants/files.ex b/lib/openai/assistants/files.ex index d7ce354..4c455d5 100644 --- a/lib/openai/assistants/files.ex +++ b/lib/openai/assistants/files.ex @@ -3,7 +3,7 @@ defmodule OpenAI.Assistants.Files do alias OpenAI.Client alias OpenAI.Config - @base_url "/v1/assistants" + @base_url "/v2/assistants" def url(assistant_id), do: "#{@base_url}/#{assistant_id}/files" def url(assistant_id, file_id), do: "#{@base_url}/#{assistant_id}/files/#{file_id}"