Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
svilupp committed Dec 23, 2023
1 parent d3f0f8d commit f937cf6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/Experimental/RAGTools/generation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ end
tag_filter = ["yes"],
return_context = false)
@test occursin("Time?", msg.content)
# different kwargs

## Test different kwargs
msg, ctx = airag(index; question = "Time?", model_embedding = "mock-emb",
model_chat = "mock-gen",
model_metadata = "mock-meta", api_kwargs = (; url = "http://localhost:$(PORT)"),
Expand All @@ -111,6 +112,19 @@ end
@test ctx.filtered_candidates.distances == 0.5ones(2)
@test ctx.reranked_candidates.positions == [2, 1] # no change
@test ctx.reranked_candidates.distances == 0.5ones(2) # no change

## Not tag filter
msg, ctx = airag(index; question = "Time?", model_embedding = "mock-emb",
model_chat = "mock-gen",
model_metadata = "mock-meta", api_kwargs = (; url = "http://localhost:$(PORT)"),
tag_filter = nothing,
return_context = true)
@test ctx.context == ["1. b\nc", "2. a\nb\nc", "3. a\nb"]
@test ctx.emb_candidates.positions == [3, 2, 1]
@test ctx.emb_candidates.distances == zeros(3)
@test ctx.tag_candidates == nothing
@test ctx.filtered_candidates.positions == [3, 2, 1] #re-sort
@test ctx.reranked_candidates.positions == [3, 2, 1] # no change
# clean up
close(echo_server)
end

0 comments on commit f937cf6

Please sign in to comment.