Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/instructor/adapters/llamacpp.ex
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ defmodule Instructor.Adapters.Llamacpp do
"<s>#{prompt}"
end

defp url() do
Keyword.get(config(), :url, "http://localhost:8080/completion")
def url() do
Keyword.get(config(), :api_url, "http://localhost:8080/completion")
end

defp chat_template() do
Expand Down
8 changes: 8 additions & 0 deletions test/instructor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ defmodule InstructorTest do

:openai_mock ->
Application.put_env(:instructor, :adapter, InstructorTest.MockOpenAI)

nil ->
:ok
end
end

Expand Down Expand Up @@ -419,4 +422,9 @@ defmodule InstructorTest do
result |> Enum.to_list()
end
end

test "Llamacpp adapter gets the url from :api_url in config" do
Application.put_env(:instructor, :llamacpp, api_url: "http://1.2.3.4:8080/completion")
assert "http://1.2.3.4:8080/completion" == Instructor.Adapters.Llamacpp.url()
end
end