Skip to content

Commit 5d2fd99

Browse files
committed
for better coverage, run tools test through streaming API
1 parent 0dd0e91 commit 5d2fd99

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/topenAIChat.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,17 @@ function invalidInputsConstructor(testCase, InvalidConstructorInput)
8888
testCase.verifyError(@()openAIChat(InvalidConstructorInput.Input{:}), InvalidConstructorInput.Error);
8989
end
9090

91-
function generateWithTools(testCase)
91+
function generateWithToolsAndStreamFunc(testCase)
9292
import matlab.unittest.constraints.HasField
9393

9494
f = openAIFunction("writePaperDetails", "Function to write paper details to a table.");
9595
f = addParameter(f, "name", type="string", description="Name of the paper.");
9696
f = addParameter(f, "url", type="string", description="URL containing the paper.");
9797
f = addParameter(f, "explanation", type="string", description="Explanation on why the paper is related to the given topic.");
9898

99-
paperExtractor = openAIChat("You are an expert in extracting information from a paper.", APIKey=getenv("OPENAI_KEY"), Tools=f);
99+
paperExtractor = openAIChat( ...
100+
"You are an expert in extracting information from a paper.", ...
101+
APIKey=getenv("OPENAI_KEY"), Tools=f, StreamFun=@(s) s);
100102

101103
input = join([
102104
" <id>http://arxiv.org/abs/2406.04344v1</id>"

0 commit comments

Comments
 (0)