Skip to content
Closed
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
3 changes: 2 additions & 1 deletion test/preparation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ end
@test_throws AssertionError get_embeddings(BitPackedBatchEmbedder(), String[])

# corresponds to OpenAI API v1
response1 = Dict(:data => [Dict(:embedding => ones(128, 2))],
response1 = Dict(:data => [Dict(:embedding => ones(Float32, 128)),
Dict(:embedding => ones(Float32, 128))],
:usage => Dict(:total_tokens => 2, :prompt_tokens => 2, :completion_tokens => 0))
schema = TestEchoOpenAISchema(; response = response1, status = 200)
PT.register_model!(; name = "mock-emb", schema)
Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ using Aqua
const PT = PromptingTools
const RT = RAGTools

# Set a dummy API key for tests using CustomOpenAISchema with mock HTTP servers
# Required since OpenAI.jl now throws an error when api_key is empty
# We set the PT global directly since it's loaded at module load time from preferences/ENV
if isempty(PT.OPENAI_API_KEY)
PT.OPENAI_API_KEY = "test-api-key-for-mock-server"
end

@testset "RAGTools.jl" begin
@testset "Code quality (Aqua.jl)" begin
Aqua.test_all(RAGTools)
Expand Down
Loading