Skip to content

Commit

Permalink
Merge branch 'main' into test-doubles
Browse files Browse the repository at this point in the history
  • Loading branch information
ccreutzi committed Aug 2, 2024
2 parents 9757ef7 + 062538c commit bd20b8f
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 11 deletions.
6 changes: 6 additions & 0 deletions +llms/+internal/textGenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@
properties (Access=protected)
StreamFun
end

methods
function hObj = set.StopSequences(hObj,value)
hObj.StopSequences = string(value);
end
end
end
1 change: 1 addition & 0 deletions +llms/+utils/mustBeValidStop.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function mustBeValidStop(value)
if ~isempty(value)
mustBeVector(value);
mustBeNonzeroLengthText(value);
value = string(value);
% This restriction is set by the OpenAI API
if numel(value)>4
error("llms:stopSequencesMustHaveMax4Elements", llms.utils.errorMessageCatalog.getMessage("llms:stopSequencesMustHaveMax4Elements"));
Expand Down
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Code owners, to get auto-filled reviewer lists

# To start with, we just assume everyone in the core team is included on all reviews
* @adulai @ccreutzi @debymf @MiriamScharnke @vpapanasta
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Pull models
run: |
ollama pull mistral
ollama pull bakllava
ollama pull moondream
OLLAMA_HOST=127.0.0.1:11435 ollama pull qwen2:0.5b
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
Expand Down
2 changes: 1 addition & 1 deletion tests/tollamaChat.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function seedFixesResult(testCase)
end

function generateWithImages(testCase)
chat = ollamaChat("bakllava");
chat = ollamaChat("moondream");
image_path = "peppers.png";
emptyMessages = messageHistory;
messages = addUserMessageWithImages(emptyMessages,"What is in the image?",image_path);
Expand Down
33 changes: 24 additions & 9 deletions tests/topenAIChat.m
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,14 @@ function keyNotFound(testCase)
function validConstructorInput = iGetValidConstructorInput()
% while it is valid to provide the key via an environment variable,
% this test set does not use that, for easier setup
validFunction = openAIFunction("funName");
validConstructorInput = struct( ...
"JustKey", struct( ...
"Input",{{"APIKey","this-is-not-a-real-key"}}, ...
"ExpectedWarning", '', ...
"VerifyProperties", struct( ...
"Temperature", {1}, ...
"TopP", {1}, ...
"StopSequences", {{}}, ...
"StopSequences", {string([])}, ...
"PresencePenalty", {0}, ...
"FrequencyPenalty", {0}, ...
"TimeOut", {10}, ...
Expand All @@ -412,7 +411,7 @@ function keyNotFound(testCase)
"VerifyProperties", struct( ...
"Temperature", {1}, ...
"TopP", {1}, ...
"StopSequences", {{}}, ...
"StopSequences", {string([])}, ...
"PresencePenalty", {0}, ...
"FrequencyPenalty", {0}, ...
"TimeOut", {10}, ...
Expand All @@ -428,7 +427,7 @@ function keyNotFound(testCase)
"VerifyProperties", struct( ...
"Temperature", {2}, ...
"TopP", {1}, ...
"StopSequences", {{}}, ...
"StopSequences", {string([])}, ...
"PresencePenalty", {0}, ...
"FrequencyPenalty", {0}, ...
"TimeOut", {10}, ...
Expand All @@ -444,7 +443,7 @@ function keyNotFound(testCase)
"VerifyProperties", struct( ...
"Temperature", {1}, ...
"TopP", {0.2}, ...
"StopSequences", {{}}, ...
"StopSequences", {string([])}, ...
"PresencePenalty", {0}, ...
"FrequencyPenalty", {0}, ...
"TimeOut", {10}, ...
Expand All @@ -470,13 +469,29 @@ function keyNotFound(testCase)
"ResponseFormat", {"text"} ...
) ...
), ...
"StopSequencesCharVector", struct( ...
"Input",{{"APIKey","this-is-not-a-real-key","StopSequences",'supercalifragilistic'}}, ...
"ExpectedWarning", '', ...
"VerifyProperties", struct( ...
"Temperature", {1}, ...
"TopP", {1}, ...
"StopSequences", {"supercalifragilistic"}, ...
"PresencePenalty", {0}, ...
"FrequencyPenalty", {0}, ...
"TimeOut", {10}, ...
"FunctionNames", {[]}, ...
"ModelName", {"gpt-4o-mini"}, ...
"SystemPrompt", {[]}, ...
"ResponseFormat", {"text"} ...
) ...
), ...
"PresencePenalty", struct( ...
"Input",{{"APIKey","this-is-not-a-real-key","PresencePenalty",0.1}}, ...
"ExpectedWarning", '', ...
"VerifyProperties", struct( ...
"Temperature", {1}, ...
"TopP", {1}, ...
"StopSequences", {{}}, ...
"StopSequences", {string([])}, ...
"PresencePenalty", {0.1}, ...
"FrequencyPenalty", {0}, ...
"TimeOut", {10}, ...
Expand All @@ -492,7 +507,7 @@ function keyNotFound(testCase)
"VerifyProperties", struct( ...
"Temperature", {1}, ...
"TopP", {1}, ...
"StopSequences", {{}}, ...
"StopSequences", {string([])}, ...
"PresencePenalty", {0}, ...
"FrequencyPenalty", {0.1}, ...
"TimeOut", {10}, ...
Expand All @@ -508,7 +523,7 @@ function keyNotFound(testCase)
"VerifyProperties", struct( ...
"Temperature", {1}, ...
"TopP", {1}, ...
"StopSequences", {{}}, ...
"StopSequences", {string([])}, ...
"PresencePenalty", {0}, ...
"FrequencyPenalty", {0}, ...
"TimeOut", {0.1}, ...
Expand All @@ -524,7 +539,7 @@ function keyNotFound(testCase)
"VerifyProperties", struct( ...
"Temperature", {1}, ...
"TopP", {1}, ...
"StopSequences", {{}}, ...
"StopSequences", {string([])}, ...
"PresencePenalty", {0}, ...
"FrequencyPenalty", {0}, ...
"TimeOut", {10}, ...
Expand Down

0 comments on commit bd20b8f

Please sign in to comment.