Skip to content

Commit

Permalink
make LLMORPHEUS_LLM_PROVIDER optional
Browse files Browse the repository at this point in the history
  • Loading branch information
franktip committed Dec 23, 2024
1 parent b1c2c01 commit 707a445
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/model/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Model implements IModel {
);

protected static LLMORPHEUS_LLM_PROVIDER = JSON.parse(
getEnv("LLMORPHEUS_LLM_PROVIDER")
getEnv("LLMORPHEUS_LLM_PROVIDER", false)
);

protected instanceOptions: PostOptions;
Expand Down
8 changes: 6 additions & 2 deletions src/util/code-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,13 @@ export function prevPosition(code: string, line: number, column: number) {
}
}

export function getEnv(name: string): string {
/**
* Get the environment variable with the given name. If the variable is not set and enforce is true, the process will exit.
* (for optional variables, set enforce to false)
*/
export function getEnv(name: string, enforce: boolean = true): string {
const value = process.env[name];
if (!value) {
if (!value && enforce) {
console.error(`Please set the ${name} environment variable.`);
process.exit(1);
}
Expand Down

0 comments on commit 707a445

Please sign in to comment.