Skip to content
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

Use openai compatible environment variables for configuration and allow configuration using more specific variables that do not interfere with the openai defaults #46

Merged
merged 3 commits into from
May 18, 2024

Conversation

mathiasburger
Copy link
Contributor

Use openai compatible environment variables for configuration and allow configuration using more specific variables that do not interfere with the openai defaults

please.sh Outdated Show resolved Hide resolved
else
messagesJson='['$(join_by , "${qaMessages[@]}")']'
fi
messagesJson='['$(join_by , "${qaMessages[@]}")']'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not work for me if qaMessages is defined as above

function join_by {
  local d=${1-} f=${2-}
  if shift 2; then
    printf %s "$f" "${@/#/$d}"
  fi
}

qaMessages=()
messagesJson='['$(join_by , "${qaMessages[@]}")']'

gives "join_by:shift:2: shift count must be <= $#"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the above code adds an element to the array: qaMessages+=, so qaMessages cannot be empty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sry my bad; works indeed fine with bash (butt actually I think it's great there are tests now :)

please.sh Outdated Show resolved Hide resolved
@mathiasburger mathiasburger force-pushed the feature/configuration branch 4 times, most recently from d04fb92 to 61a0425 Compare May 8, 2024 09:18
…ow configuration using more specific variables that do not interfere with the openai defaults

Signed-off-by: Mathias Burger <[email protected]>
@mathiasburger mathiasburger force-pushed the feature/configuration branch 3 times, most recently from 32f0a16 to 33fcb1e Compare May 8, 2024 09:31
@mathiasburger mathiasburger force-pushed the feature/configuration branch from 33fcb1e to 6677a13 Compare May 8, 2024 09:32
Copy link
Contributor

@fabiankle fabiankle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! (but I guess Thomas should approve it? Actually I am surprised I actually can at least in this form ;))

Just one suggestion for additional tests (which btw I really appreciate being added!)

else
messagesJson='['$(join_by , "${qaMessages[@]}")']'
fi
messagesJson='['$(join_by , "${qaMessages[@]}")']'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sry my bad; works indeed fine with bash (butt actually I think it's great there are tests now :)

- name: Install BATS
run: sudo apt-get update && sudo apt-get install -y bats
- name: Run BATS Tests
run: bats --formatter tap test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really cool;

If you'd like, how about adding some smoke test test/please.bats

#!/usr/bin/env bats

PLEASE_EXE=$BATS_TEST_DIRNAME/../please.sh

@test "smoke test please --help" {
  result=$($PLEASE_EXE '--help')
  [ "${result:0:6}" == "Please" ]
}

@test "smoke test please --version" {
  result=$($PLEASE_EXE '--version')
  [ "${result:0:8}" == "Please v" ]
}

(just to make sure the main() is called correctly)

@mathiasburger mathiasburger force-pushed the feature/configuration branch from e3e9e70 to 0641366 Compare May 17, 2024 13:46
@thomas-endres-tng thomas-endres-tng merged commit 494d196 into TNG:main May 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants