-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OPENAI_KEY as env variable and extra tests #27
Conversation
Checking secrets key configuration in yml config file
Add first test to check secret PENAI_KEY
Add extra test to increase code coverage in openAIChat
Adding negative tests to increase code coverage in openAIMessages/validateAssistantWithToolCalls
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Adding extra tests to increase code coverage in extractOpenAIEmbeddings
Add openAIImages positive test using OPENAI_KEY to increase code coverage
Changing createOpenAIChatWithStreamFunc as suggested by Christopher
@@ -13,6 +13,8 @@ jobs: | |||
products: Text_Analytics_Toolbox | |||
cache: true | |||
- name: Run tests and generate artifacts | |||
env: | |||
OPENAI_KEY: ${{ secrets.OPENAI_KEY }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPENAI_API_KEY
to match the env variable that we expect?
We might have to remove this part from the test:
function saveEnvVar(testCase)
% Ensures key is not in environment variable for tests
openAIEnvVar = "OPENAI_API_KEY";
if isenv(openAIEnvVar)
key = getenv(openAIEnvVar);
unsetenv(openAIEnvVar);
testCase.addTeardown(@(x) setenv(openAIEnvVar, x), key);
end
end
I have added that because when I was running local tests on some behaviors related to checking the key it would turn out that the key was already in my path. We should just move that to where it's actually needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For local debugging we should still use the manually defined OPENAI_API_KEY
. I do not think it harms to keep this check to make sure that OPENAI_API_KEY
is not in environment variable for tests. OPENAI_KEY
defined in .github/workflows/ci.yml
is a different environment variable and it is secret.
In this change, I am setting
secrets.OPENAI_KEY
as an environment variable that we can use in tests.Also, I am adding some tests to increase code coverage in openAIChat. One test of these uses the secret OPENAI_KEY, and it was added to check that we can use the key.