evals 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,12 +39,12 @@ To save the file, press `Ctrl + X`, then `Y`, then `Enter`. Then, run `source ~/
39
39
  ## Example usage
40
40
 
41
41
  ```bash
42
- umbrage-cli fetch-evals
42
+ npx evals@latest fetch-evals
43
43
 
44
- umbrage-cli run-evals
44
+ npx evals@latest run-evals
45
45
  ```
46
46
 
47
- ## Example BaseModel
47
+ ## Example Prompt BaseModel
48
48
 
49
49
  ```typescript
50
50
  export interface ModelSettings {
@@ -84,66 +84,13 @@ class BaseModel {
84
84
  * @returns Promise<{ response: string, prompts: Prompt[] }>
85
85
  */
86
86
  async callModel(userMessage: string = ''): Promise<{ response: string; prompts: Prompt[] }> {
87
- throw new Error('callModel method needs to be implemented in subclasses');
87
+ throw new Error('callModel method needs to be implemented');
88
88
  }
89
89
  }
90
90
 
91
91
  export default BaseModel;
92
92
  ```
93
93
 
94
- ## Example Prompt (OpenAI API)
95
-
96
- ```typescript
97
- import BaseModel from './BaseModel';
98
- import OpenAI from 'openai';
99
-
100
- class ChevySalesCopilotPrompt extends BaseModel {
101
- constructor() {
102
- const config = {
103
- promptName: 'Chevy Sales Copilot',
104
- modelName: 'gpt-4',
105
- modelSettings: { temperature: 0.2 },
106
- environment: 'development'
107
- };
108
- super(config);
109
-
110
- this.openai = new OpenAI(); // Assumes OPENAI_API_KEY is set in environment
111
- this.messages = [
112
- { role: 'system', content: 'You are a Chevy Sales Copilot assistant. You can only help with topics related to sales at Chevrolet. If asked your name your name is "Sales Copilot".' }
113
- ];
114
- }
115
-
116
- async callModel(userMessage) {
117
- try {
118
- // Update messages with user input
119
- const updatedMessages = [...this.messages, { role: 'user', content: userMessage }];
120
-
121
- const modelResponse = await this.openai.chat.completions.create({
122
- model: this.modelName,
123
- messages: updatedMessages,
124
- temperature: this.modelSettings.temperature,
125
- });
126
-
127
- const response = modelResponse.choices[0].message.content;
128
-
129
- const prompts = updatedMessages.map(message => ({
130
- prompt_type: message.role,
131
- prompt_text: message.content,
132
- }));
133
-
134
- return { response, prompts };
135
- } catch (error) {
136
- console.error('Error:', error);
137
- throw error;
138
- }
139
- }
140
- }
141
-
142
- const prompt = new ChevySalesCopilotPrompt();
143
-
144
- export default prompt;
145
-
146
- ```
147
94
 
148
95
  ## LICENSE
149
96
 
package/dist/index.js CHANGED
@@ -15266,7 +15266,8 @@ program.command("fetch-evals").description("Fetch the latest evals for the proje
15266
15266
  }
15267
15267
  };
15268
15268
  try {
15269
- const promptsDir = "./prompts/";
15269
+ const currentWorkingDir = process.cwd();
15270
+ const promptsDir = `${currentWorkingDir}/prompts/`;
15270
15271
  const promptFiles = fs2.readdirSync(promptsDir).filter((file) => file.endsWith(".prompt.js"));
15271
15272
  const processingPromises = promptFiles.map(processPromptFile);
15272
15273
  await Promise.all(processingPromises);
@@ -15280,7 +15281,8 @@ program.command("run-evals").description("Run evals in the current directory and
15280
15281
  throw new Error("OPENAI_API_KEY is not set in the environment variables.");
15281
15282
  }
15282
15283
  const openai = new openai_default;
15283
- const promptsDir = "./prompts/";
15284
+ const currentWorkingDir = process.cwd();
15285
+ const promptsDir = `${currentWorkingDir}/prompts/`;
15284
15286
  const model = "gpt-4-1106-preview";
15285
15287
  const temperature = 0;
15286
15288
  const processMarkdownFile = async (evalsFolder, evalFile, promptInstance) => {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
7
- "version": "1.0.5",
7
+ "version": "1.0.7",
8
8
  "description": "Umbrage Evals CLI",
9
9
  "bin": {
10
10
  "evals": "./src/index.js"
package/src/index.js CHANGED
@@ -59,7 +59,8 @@ program
59
59
  };
60
60
 
61
61
  try {
62
- const promptsDir = './prompts/';
62
+ const currentWorkingDir = process.cwd(); // Get the current working directory
63
+ const promptsDir = `${currentWorkingDir}/prompts/`; // Use it as the base for your prompts directory
63
64
  const promptFiles = fs.readdirSync(promptsDir).filter(file => file.endsWith('.prompt.js'));
64
65
 
65
66
  const processingPromises = promptFiles.map(processPromptFile);
@@ -80,7 +81,8 @@ program
80
81
  }
81
82
 
82
83
  const openai = new OpenAI(); // Assumes OPENAI_API_KEY is set in environment
83
- const promptsDir = './prompts/';
84
+ const currentWorkingDir = process.cwd(); // Get the current working directory
85
+ const promptsDir = `${currentWorkingDir}/prompts/`; // Use it as the base for your prompts directory
84
86
  const model = 'gpt-4-1106-preview';
85
87
  const temperature = 0;
86
88