repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
promptfoo
github_2023
typescript
2,016
promptfoo
typpo
@@ -230,15 +230,38 @@ export abstract class RedteamGraderBase { }): ResultSuggestion[] { return []; } + protected handleRefusal( + provider: ApiProvider | undefined, + isRefusal: boolean | undefined, + ): { grade: GradingResult; rubric: string } | undefined { + if (isRefusal) { + return {
Because refusals pass by default, aren't we ok without this logic? Would it also be nice to see the actual refusal output, which is the current behavior?
promptfoo
github_2023
typescript
2,089
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,65 @@ +import { XMLParser } from 'fast-xml-parser'; + +export function validateXml( + xmlString: string, + requiredElements?: string[], +): { isValid: boolean; reason: string } { + if (!xmlString.startsWith('<')) { + return { isValid: false, reason: 'XML is missing opening tag' }; + } + const parser ...
## Polynomial regular expression used on uncontrolled data This [regular expression](1) that depends on [library input](2) may run slow on strings starting with '<?xml' and with many repetitions of '<?xml'. This [regular expression](3) that depends on [library input](2) may run slow on strings starting with '<?xml>' a...
promptfoo
github_2023
others
2,072
promptfoo
coderabbitai[bot]
@@ -0,0 +1,47 @@ +--- +sidebar_label: Intent +--- + +# Intent Plugin + +The Intent red teaming plugin is designed to test whether an AI system can be manipulated to exhibit specific behaviors or responses. Unlike the Policy plugin which enforces guidelines, the Intent plugin actively attempts to elicit particular (pote...
_:hammer_and_wrench: Refactor suggestion_ **Revise examples and add configuration details.** While the examples effectively demonstrate the syntax, consider: 1. Using less extreme examples that still demonstrate the concept (e.g., "bypass content filters" instead of specific harmful actions) 2. Adding information abo...
promptfoo
github_2023
others
2,072
promptfoo
coderabbitai[bot]
@@ -0,0 +1,47 @@ +--- +sidebar_label: Intent +--- + +# Intent Plugin + +The Intent red teaming plugin is designed to test whether an AI system can be manipulated to exhibit specific behaviors or responses. Unlike the Policy plugin which enforces guidelines, the Intent plugin actively attempts to elicit particular (pote...
_:warning: Potential issue_ **Fix grammatical error: "illicit" should be "elicit".** The word "illicit" (meaning illegal/forbidden) should be replaced with "elicit" (meaning to draw out/evoke). ```diff -The Intent plugin creates one test case for each intent specified. The intent text is used directly as the prompt ...
promptfoo
github_2023
others
2,072
promptfoo
coderabbitai[bot]
@@ -0,0 +1,47 @@ +--- +sidebar_label: Intent +--- + +# Intent Plugin + +The Intent red teaming plugin is designed to test whether an AI system can be manipulated to exhibit specific behaviors or responses. Unlike the Policy plugin which enforces guidelines, the Intent plugin actively attempts to elicit particular (pote...
_:hammer_and_wrench: Refactor suggestion_ **Add a security disclaimer for responsible usage.** Given the sensitive nature of red teaming and potential for misuse, consider adding a prominent security warning about responsible usage and the importance of obtaining proper authorization before testing. ```diff # Inten...
promptfoo
github_2023
typescript
2,072
promptfoo
coderabbitai[bot]
@@ -68,6 +68,14 @@ export default function Review() { ); }, [config.plugins]); + const intents = useMemo(() => { + return config.plugins + .filter((p): p is { id: string; config?: any } => typeof p === 'object' && p.id === 'intent') + .map((p) => p.config.intent) + .flat() + .filter((i...
_:hammer_and_wrench: Refactor suggestion_ **Improve type safety and error handling in intent processing.** The current implementation could benefit from better type safety and error handling: Consider applying these improvements: ```diff const intents = useMemo(() => { return config.plugins - .filter((p): p...
promptfoo
github_2023
typescript
2,072
promptfoo
coderabbitai[bot]
@@ -169,7 +242,14 @@ export default function PluginConfigDialog({ }; return ( - <Dialog open={open} onClose={onClose} maxWidth="sm" fullWidth> + <Dialog + open={open} + onClose={onClose} + maxWidth="sm" + fullWidth + // Add this to prevent accidental closes + onBackdropClick=...
_:hammer_and_wrench: Refactor suggestion_ **Consider using a confirmation dialog instead of disabling backdrop clicks** Completely preventing dialog closure via backdrop clicks might not align with Material-UI's usability patterns. Users typically expect clicking outside a dialog to close it. Consider showing a conf...
promptfoo
github_2023
typescript
2,072
promptfoo
coderabbitai[bot]
@@ -0,0 +1,115 @@ +import dedent from 'dedent'; +import invariant from 'tiny-invariant'; +import type { ApiProvider, Assertion, AtomicTestCase, GradingResult, TestCase } from '../../types'; +import { RedteamPluginBase, RedteamGraderBase } from './base'; + +export const PLUGIN_ID = 'promptfoo:redteam:intent'; + +export ...
_:hammer_and_wrench: Refactor suggestion_ **Ensure consistent `id` assignment by setting `id` to `PLUGIN_ID`** Currently, `IntentPlugin`'s `id` is set to `'intent'`, while `PLUGIN_ID` is `'promptfoo:redteam:intent'`. For consistency and to avoid potential issues, consider assigning `id = PLUGIN_ID`. Apply this dif...
promptfoo
github_2023
others
2,049
promptfoo
coderabbitai[bot]
@@ -6,7 +6,13 @@ sidebar_position: 60 ## Out of memory error -To increase the amount of memory available to Promptfoo, increase the node heap size using the `--max-old-space-size` flag. For example: +If you have a large number of tests or your tests have large outputs, you may encounter an out of memory error. Set...
_:hammer_and_wrench: Refactor suggestion_ **Add context about memory improvements.** Consider adding a note about the expected memory improvements, similar to what's mentioned in the PR description. For example: ```diff 3. Only output to `jsonl` ex: `--output results.jsonl` +These optimizations can significantly re...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -0,0 +1,198 @@ +import request from 'supertest'; +import invariant from 'tiny-invariant'; +import { runDbMigrations } from '../../src/migrate'; +import Eval from '../../src/models/eval'; +import EvalResult from '../../src/models/evalResult'; +import { createApp } from '../../src/server/server'; +import EvalFactory f...
_:hammer_and_wrench: Refactor suggestion_ **Extract common test setup logic to reduce duplication.** The first two tests contain duplicated code for payload preparation. Consider extracting this into a helper function. ```typescript function createRatingPayload(originalResult: any, pass: boolean) { const payload =...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -0,0 +1,198 @@ +import request from 'supertest'; +import invariant from 'tiny-invariant'; +import { runDbMigrations } from '../../src/migrate'; +import Eval from '../../src/models/eval'; +import EvalResult from '../../src/models/evalResult'; +import { createApp } from '../../src/server/server'; +import EvalFactory f...
_:hammer_and_wrench: Refactor suggestion_ **Use constants for magic numbers in assertions.** The tests use magic numbers (0, 1, 2) for metrics assertions. Consider defining these as named constants to improve readability and maintenance. ```typescript const METRICS = { PASS_SCORE: 1, FAIL_SCORE: 0, INITIAL_COU...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -0,0 +1,198 @@ +import request from 'supertest'; +import invariant from 'tiny-invariant'; +import { runDbMigrations } from '../../src/migrate'; +import Eval from '../../src/models/eval'; +import EvalResult from '../../src/models/evalResult'; +import { createApp } from '../../src/server/server'; +import EvalFactory f...
_:hammer_and_wrench: Refactor suggestion_ **Consider using test hooks for database state verification.** The database state verification logic is repeated across tests. Consider using custom test hooks or assertions to make the tests more maintainable: ```typescript async function verifyResultState(resultId: string,...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -0,0 +1,198 @@ +import request from 'supertest'; +import invariant from 'tiny-invariant'; +import { runDbMigrations } from '../../src/migrate'; +import Eval from '../../src/models/eval'; +import EvalResult from '../../src/models/evalResult'; +import { createApp } from '../../src/server/server'; +import EvalFactory f...
_:hammer_and_wrench: Refactor suggestion_ **Consider enhancing test setup with cleanup and scoped app creation.** While the current setup is functional, consider these improvements: 1. Move app creation inside `beforeAll` to ensure a fresh instance for each test run 2. Add `afterAll` to clean up the database after te...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -0,0 +1,107 @@ +import type Eval from '../../models/eval'; +import type EvalResult from '../../models/evalResult'; +import type { EvaluateTableRow } from '../../types'; + +export function getHeaderForTable(eval_: Eval) { + const varsForHeader = new Set<string>(); + + if (eval_.config.defaultTest?.vars) { + for ...
_:warning: Potential issue_ **Add safety checks when accessing `testCase.vars` to prevent runtime errors** In the `convertTestResultsToTableRow` function, you access `results[0].testCase.vars` without verifying if `testCase` and `vars` are defined. This could lead to runtime errors if `testCase` is undefined or lacks...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -0,0 +1,107 @@ +import type Eval from '../../models/eval'; +import type EvalResult from '../../models/evalResult'; +import type { EvaluateTableRow } from '../../types'; + +export function getHeaderForTable(eval_: Eval) { + const varsForHeader = new Set<string>(); + + if (eval_.config.defaultTest?.vars) { + for ...
_:hammer_and_wrench: Refactor suggestion_ **Refactor repetitive code in `getHeaderForTable` for better maintainability** The `getHeaderForTable` function contains repetitive loops for extracting variable names from various nested configurations (`defaultTest.vars`, `tests`, `scenarios`, etc.). This repetition can be ...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -134,11 +134,66 @@ evalRouter.post( const gradingResult = req.body as GradingResult; const result = await EvalResult.findById(id); invariant(result, 'Result not found'); + const eval_ = await Eval.findById(result.evalId); + invariant(eval_, 'Eval not found'); +
_:warning: Potential issue_ **Return 404 for Missing Evaluation** Currently, if the evaluation (`eval_`) is not found, the code throws an error. It's better practice to return a 404 Not Found response to indicate that the resource doesn't exist. Apply this diff to handle the missing evaluation: ```diff - invarian...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -134,11 +134,66 @@ evalRouter.post( const gradingResult = req.body as GradingResult; const result = await EvalResult.findById(id); invariant(result, 'Result not found'); + const eval_ = await Eval.findById(result.evalId); + invariant(eval_, 'Eval not found'); + + // Capture the current state ...
_:warning: Potential issue_ **Add Null Check for `componentResults`** When checking for `hasExistingManualOverride`, if `componentResults` is `undefined`, calling `.some()` will throw an error. Ensure that `componentResults` is defined before invoking `.some()`. Apply this diff to add the null check: ```diff - co...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -134,11 +134,66 @@ evalRouter.post( const gradingResult = req.body as GradingResult; const result = await EvalResult.findById(id); invariant(result, 'Result not found'); + const eval_ = await Eval.findById(result.evalId); + invariant(eval_, 'Eval not found'); + + // Capture the current state ...
_:warning: Potential issue_ **Use Appropriate HTTP Status Code for Server Errors** Returning a 400 Bad Request when `prompt.metrics` is missing may mislead the client into thinking the request was malformed. Since this is likely a server-side issue, consider returning a 500 Internal Server Error instead. Apply thi...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -134,11 +134,66 @@ evalRouter.post( const gradingResult = req.body as GradingResult; const result = await EvalResult.findById(id); invariant(result, 'Result not found'); + const eval_ = await Eval.findById(result.evalId); + invariant(eval_, 'Eval not found'); + + // Capture the current state ...
_:hammer_and_wrench: Refactor suggestion_ **Refactor Metrics Update Logic for Clarity** The nested conditionals for updating `prompt.metrics` are complex and might be error-prone. Refactoring this logic can improve readability and maintainability. Consider simplifying the metrics update logic: ```diff - // Existi...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -630,6 +637,19 @@ class Evaluator { } catch (error) { logger.error(`Error saving result: ${error} ${JSON.stringify(row)}`); } + + const outputPath = this.evalRecord.config.outputPath; + const jsonlFiles = Array.isArray(outputPath) + ? outputPath.filter((p) => p.endsWith('.json...
_:warning: Potential issue_ **Potential race conditions and performance issues with synchronous file writes** Using `fs.appendFileSync` within an async function that's called concurrently can lead to performance bottlenecks and potential data corruption due to blocking the event loop and simultaneous writes to the sa...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -118,14 +119,33 @@ export async function writeOutput( } if (outputExtension === 'csv') { - const csvOutput = stringify([ - [ - ...table.head.vars, - ...table.head.prompts.map((prompt) => `[${prompt.provider}] ${prompt.label}`), - ], - ...table.body.map((row) => [...row.vars, ....
_:warning: Potential issue_ **Potential file overwrite without warning in 'fs.writeFileSync'.** The use of `fs.writeFileSync(outputPath, headerCsv);` will overwrite any existing file at `outputPath` without warning. To prevent unintentional data loss, consider checking if the file exists and notifying the user, or ap...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -84,10 +86,9 @@ export async function writeOutput( evalRecord: Eval, shareableUrl: string | null, ) { - const table = await evalRecord.getTable(); - - invariant(table, 'Table is required'); if (outputPath.match(/^https:\/\/docs\.google\.com\/spreadsheets\//)) { + const table = await evalRecord.getTabl...
_:hammer_and_wrench: Refactor suggestion_ **Refactor repeated 'getTable' calls to a helper function.** The code segments at lines 90-91 and 176-177 both retrieve the table using `await evalRecord.getTable()` and then assert its existence with `invariant(table, 'Table is required')`. Consider refactoring this repeated...
promptfoo
github_2023
typescript
2,049
promptfoo
coderabbitai[bot]
@@ -168,6 +190,11 @@ export async function writeOutput( results: summary, }); fs.writeFileSync(outputPath, htmlOutput); + } else if (outputExtension === 'jsonl') { + for await (const batchResults of evalRecord.fetchResultsBatched()) { + const text = batchResults.map((result) => JSON.stringify(...
_:warning: Potential issue_ **Ensure the output file is truncated before writing 'jsonl' data.** When writing JSON Lines output, `fs.appendFileSync` appends data to `outputPath` without clearing existing content. This may result in duplicated or corrupted data if the file already exists. To prevent this, ensure the f...
promptfoo
github_2023
typescript
2,055
promptfoo
github-advanced-security[bot]
@@ -24,6 +27,30 @@ // Running jobs const evalJobs = new Map<string, Job>(); +evalRouter.post('/provider/upload', async (req: Request, res: Response): Promise<void> => { + try { + const { fileName, fileContent } = req.body; + + // Create temp directory if it doesn't exist + const tempDir = path.join(os.tmp...
## Missing rate limiting This route handler performs [a file system access](1), but is not rate-limited. This route handler performs [a file system access](2), but is not rate-limited. This route handler performs [a file system access](3), but is not rate-limited. [Show more details](https://github.com/promptfoo/prom...
promptfoo
github_2023
typescript
2,055
promptfoo
github-advanced-security[bot]
@@ -24,6 +27,30 @@ // Running jobs const evalJobs = new Map<string, Job>(); +evalRouter.post('/provider/upload', async (req: Request, res: Response): Promise<void> => { + try { + const { fileName, fileContent } = req.body; + + // Create temp directory if it doesn't exist + const tempDir = path.join(os.tmp...
## Uncontrolled data used in path expression This path depends on a [user-provided value](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/42)
promptfoo
github_2023
typescript
2,055
promptfoo
coderabbitai[bot]
@@ -0,0 +1,20 @@ +import type { ProviderOptions } from '@promptfoo/types'; +import { create } from 'zustand'; + +interface ProvidersState { + customProviders: ProviderOptions[]; + addCustomProvider: (provider: ProviderOptions) => void; + removeCustomProvider: (providerId: string) => void; +} + +export const useProvi...
_:hammer_and_wrench: Refactor suggestion_ **Add validation and error handling to store operations.** The store implementation needs additional safeguards: 1. Prevent duplicate provider IDs 2. Add error handling for provider removal 3. Validate provider object structure ```diff export const useProvidersStore = creat...
promptfoo
github_2023
others
2,055
promptfoo
coderabbitai[bot]
@@ -7,6 +7,7 @@ "dev": "vite", "tsc": "tsc", "build": "tsc -b && vite build", + "build:watch": "tsc -b --watch",
_:bulb: Codebase verification_ **TypeScript watch mode configuration needs adjustment** The `build:watch` script won't work as expected because: - The app's tsconfig files (`tsconfig.app.json` and `tsconfig.node.json`) both have `"noEmit": true` - They use bundler-style configuration meant for Vite/bundler integratio...
promptfoo
github_2023
typescript
2,055
promptfoo
coderabbitai[bot]
@@ -190,103 +195,99 @@ interface ProviderSelectorProps { } const ProviderSelector: React.FC<ProviderSelectorProps> = ({ providers, onChange }) => { + const { customProviders, addCustomProvider } = useProvidersStore(); const [selectedProvider, setSelectedProvider] = React.useState<ProviderOptions | null>(null); ...
_:hammer_and_wrench: Refactor suggestion_ **Enhance keyboard navigation support** The Autocomplete component should support keyboard navigation for better accessibility. Additionally, the chip click handler should be keyboard-accessible. Consider these improvements: ```diff onChange={(event, newValue: (string | Pr...
promptfoo
github_2023
typescript
2,055
promptfoo
coderabbitai[bot]
@@ -190,103 +195,99 @@ interface ProviderSelectorProps { } const ProviderSelector: React.FC<ProviderSelectorProps> = ({ providers, onChange }) => { + const { customProviders, addCustomProvider } = useProvidersStore(); const [selectedProvider, setSelectedProvider] = React.useState<ProviderOptions | null>(null); ...
_:hammer_and_wrench: Refactor suggestion_ **Add error handling for provider addition** The `handleAddLocalProvider` function should include error handling to gracefully handle potential issues during provider addition. Consider this approach: ```diff const handleAddLocalProvider = (provider: ProviderOptions) => { ...
promptfoo
github_2023
typescript
2,034
promptfoo
mldangelo
@@ -108,4 +108,48 @@ export function authCommand(program: Command) { logger.info(chalk.green('Successfully logged out')); process.exit(0); }); + + authCommand + .command('whoami') + .description('Show current user information') + .action(async () => { + try { + const email = get...
```suggestion ```
promptfoo
github_2023
typescript
2,034
promptfoo
mldangelo
@@ -108,4 +108,48 @@ export function authCommand(program: Command) { logger.info(chalk.green('Successfully logged out')); process.exit(0); }); + + authCommand + .command('whoami') + .description('Show current user information') + .action(async () => { + try { + const email = get...
```suggestion ```
promptfoo
github_2023
typescript
2,034
promptfoo
mldangelo
@@ -108,4 +108,48 @@ export function authCommand(program: Command) { logger.info(chalk.green('Successfully logged out')); process.exit(0); }); + + authCommand + .command('whoami') + .description('Show current user information') + .action(async () => { + try { + const email = get...
```suggestion process.exitCode = 1; ```
promptfoo
github_2023
typescript
2,034
promptfoo
mldangelo
@@ -108,4 +108,48 @@ export function authCommand(program: Command) { logger.info(chalk.green('Successfully logged out')); process.exit(0); }); + + authCommand + .command('whoami') + .description('Show current user information') + .action(async () => { + try { + const email = get...
```suggestion logger.info(dedent` Currently logged in as: User: ${user.email} Organization: ${organization.name} App URL: ${cloudConfig.getAppUrl()}`, ); ```
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -2,15 +2,47 @@ import invariant from 'tiny-invariant'; import { getEnvInt, getEnvBool } from './envars'; import logger from './logger'; +import { sleep } from './util/time'; export async function fetchWithProxy( url: RequestInfo, options: RequestInit = {}, ): Promise<Response> { + let finalUrl = url; +...
## Server-side request forgery The [URL](1) of this request depends on a [user-provided value](2). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/29)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -1,3 +1,5 @@ export function getCurrentTimestamp() { return Math.floor(new Date().getTime() / 1000); } + +export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
## Resource exhaustion This creates a timer with a user-controlled duration from a [user-provided value](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/30)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,412 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Basic dXNlcm5hbWU6cGFzc3dvcmQ=" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/31)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,412 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Bearer token123" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/32)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,412 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Bearer token123" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/33)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,412 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Bearer token123" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/34)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,412 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Bearer token123" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/35)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,412 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Basic OnBhc3N3b3Jk" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/36)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,412 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Basic Og==" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/37)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,412 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Basic dXNlcm5hbWU6" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/38)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,412 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Basic dXNlcm5hbWU6cGFzc3dvcmQ=" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/39)
promptfoo
github_2023
typescript
2,013
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,402 @@ +import { ProxyAgent } from 'proxy-agent'; +import { getEnvBool } from '../src/envars'; +import { + fetchWithProxy, + fetchWithRetries, + fetchWithTimeout, + handleRateLimit, + isRateLimited, +} from '../src/fetch'; +import logger from '../src/logger'; +import { sleep } from '../src/util/time'; +...
## Hard-coded credentials The hard-coded value "Basic OnBhc3N3b3Jk" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/40)
promptfoo
github_2023
typescript
1,980
promptfoo
typpo
@@ -0,0 +1,27 @@ + +import type { Cache as GatewayCache } from '@adaline/gateway';
Maybe we can tuck this into `providers` subdirectory as it is a provider-specific cache?
promptfoo
github_2023
typescript
1,980
promptfoo
typpo
@@ -125,6 +130,19 @@ class Evaluator { }; this.conversations = {}; this.registers = {}; + this.gateway = new Gateway({
If possible, I would like to avoid instantiating a Gateway in evaluator. This is a hot path that every eval runs through, so provider-specific logic is not ideal. Could we instantiate in the Gateway provider?
promptfoo
github_2023
typescript
1,980
promptfoo
typpo
@@ -56,6 +57,10 @@ export class GroqProvider implements ApiProvider { return this.modelName; } + getApiKey(): string | undefined {
Thanks for cleaning up this implementation!
promptfoo
github_2023
typescript
1,990
promptfoo
typpo
@@ -29,8 +29,9 @@ import { import { doGenerateRedteam } from './generate'; const REDTEAM_CONFIG_TEMPLATE = `# Red teaming configuration -# Docs: https://promptfoo.dev/docs/red-team/configuration +# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
schema doesn't include targets and some other redteam specific transformations.
promptfoo
github_2023
typescript
1,982
promptfoo
mldangelo
@@ -1,3 +1,4 @@ +import { version } from '../../package.json';
nit, prefer VERSION from constants
promptfoo
github_2023
typescript
1,968
promptfoo
github-advanced-security[bot]
@@ -9,10 +7,10 @@ url: RequestInfo, options: RequestInit = {}, ): Promise<Response> { - options.agent = new ProxyAgent({ + const agent = new ProxyAgent({ rejectUnauthorized: false, // Don't check SSL cert - }) as unknown as RequestInit['agent']; - return fetch(url, options); + }); + return fetch(url, ...
## Server-side request forgery The [URL](1) of this request depends on a [user-provided value](2). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/22)
promptfoo
github_2023
others
1,921
promptfoo
mldangelo
@@ -0,0 +1,63 @@ +--- +sidebar_label: Does Fuzzing LLMs Actually Work? +title: Does Fuzzing LLMs Actually Work? +image: /img/blog/fuzzing/red_panda_firewood.png +date: 2024-10-017
```suggestion date: 2024-10-17 ```
promptfoo
github_2023
others
1,953
promptfoo
sklein12
@@ -91,3 +91,24 @@ telnet 127.0.0.1 4444 If you encounter errors in your Python script, the error message and stack trace will be displayed in the promptfoo output. Make sure to check this information for clues about what might be going wrong in your code. Remember that promptfoo runs your Python script in a separa...
can you rename this to `PROMPTFOO_ENABLE_DATABASE_LOGS` ?
promptfoo
github_2023
typescript
1,952
promptfoo
mldangelo
@@ -448,3 +455,225 @@ export const subCategoryDescriptions: Record<Plugin | Strategy, string> = { 'sql-injection': 'Attempts to perform SQL injection attacks to manipulate database queries', ssrf: 'Server-Side Request Forgery (SSRF) tests', }; + +// These names are displayed in risk cards and in the table +expor...
we should do some refactoring between this and displayNameOverrides
promptfoo
github_2023
typescript
1,940
promptfoo
typpo
@@ -0,0 +1,31 @@ +import { useCallback } from 'react'; +import { callApi } from '@app/utils/api'; +import type { EventProperties, TelemetryEventTypes } from '@promptfoo/telemetry'; + +export function useTelemetry() { + const recordEvent = useCallback( + async (eventName: TelemetryEventTypes, properties: EventProper...
Is this additional envar necessary? The server side already won't record telemetry if `PROMPTFOO_DSIABLE_TELEMETRY` is set, so this new envar is just cosmetic.
promptfoo
github_2023
typescript
1,925
promptfoo
typpo
@@ -92,10 +93,31 @@ export interface Palm2ApiResponse { ]; } -export function maybeCoerceToGeminiFormat(contents: any) { +const GeminiFormatSchema = z.object({
Isn't `contents` potentially a list and `parts` too? https://ai.google.dev/gemini-api/docs/quickstart?lang=rest
promptfoo
github_2023
typescript
1,925
promptfoo
typpo
@@ -184,13 +184,14 @@ export class VertexChatProvider extends VertexGenericProvider { async callGeminiApi(prompt: string, context?: CallApiContextParams): Promise<ProviderResponse> { // https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/gemini#gemini-pro - let contents = parseChatPrompt(...
parseChatPrompt takes a type `parseChatPrompt<{...}>` probably should be a GeminiFormat in there
promptfoo
github_2023
typescript
1,925
promptfoo
typpo
@@ -91,27 +93,68 @@ export interface Palm2ApiResponse { ]; } -export function maybeCoerceToGeminiFormat(contents: any) { +const PartSchema = z.object({ + text: z.string().optional(), + inline_data: z + .object({ + mime_type: z.string(), + data: z.string(), + }) + .optional(), +}); + +const Co...
let's just return `{contents, false}`? that way when google changes the api for the 134902390423rd time, we don't break
promptfoo
github_2023
typescript
1,926
promptfoo
typpo
@@ -2,18 +2,19 @@ import React, { useState } from 'react'; import type { LinkProps } from 'react-router-dom'; import { Link, useLocation } from 'react-router-dom'; import { IS_RUNNING_LOCALLY } from '@app/constants'; +import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; import EngineeringIcon from '@m...
we have a convention of expanding these imports for tree shaking/dev experience https://mui.com/material-ui/guides/minimizing-bundle-size/#development-environment I think we violated this in the redteam setup, so we need to go back and fix that, but at least we shouldn't spread it to other files
promptfoo
github_2023
typescript
1,926
promptfoo
typpo
@@ -51,6 +52,56 @@ function NavLink({ href, label }: { href: string; label: string }) { ); } +function NewDropdown() {
`CreateDropdown`?
promptfoo
github_2023
others
1,920
promptfoo
typpo
@@ -38,7 +38,31 @@ tests: language: 'French' ``` -If not specified, HTTP POST with content-type application/json is assumed. +If not specified, HTTP POST with content-type application/json is assumed if the body is an object or array. + +The body can be a string or a JSON object. If the body is a string, it w...
```suggestion `body` can be a string or a JSON object. If the body is a string, it will be sent as a raw request body and you may have to specify a `Content-Type` header. If the body is an object, then content type is automatically set to `application/json`. ```
promptfoo
github_2023
others
1,909
promptfoo
mldangelo
@@ -260,3 +260,8 @@ jobs: echo "Error: Expected 1 entry, but got $count" exit 1 fi + + - name: Share to cloud + run: | + node dist/src/main.js auth login -k ${{ secrets.PROMPTFOO_STAGING_API_KEY }} -h https://api.promptfoo-staging.app
maybe we should `npm link` promptfoo although that may be more ambiguous than doing it this way.
promptfoo
github_2023
typescript
1,909
promptfoo
mldangelo
@@ -69,7 +69,10 @@ export class CloudConfig { }; } - async validateAndSetApiToken(token: string, apiHost: string): Promise<void> { + async validateAndSetApiToken( + token: string, + apiHost: string, + ): Promise<{ user: any; organization: any; app: any }> {
can we type this better?
promptfoo
github_2023
others
1,910
promptfoo
mldangelo
@@ -108,7 +108,7 @@ jobs: id: eval run: | npm install - PROMPTFOO_REMOTE_API_BASE_URL=http://localhost:3000 PROMPTFOO_SHARING_APP_BASE_URL=http://localhost:3000 run local -- eval -c .github/workflows/files/promptfooconfig.yaml --share + PROMPTFOO_REMOTE_API_BASE_URL=http:/...
consider ```yaml - name: run promptfoo eval id: eval env: PROMPTFOO_REMOTE_API_BASE_URL: http://localhost:3000 PROMPTFOO_SHARING_APP_BASE_URL: http://localhost:3000 run: | npm install npm run local -- eval -c .github/workflows/files/promp...
promptfoo
github_2023
typescript
1,885
promptfoo
mldangelo
@@ -228,6 +229,7 @@ export const subCategoryDescriptions: Record<Plugin | Strategy, string> = { 'ascii-smuggling': 'Attempts to obfuscate malicious content using ASCII smuggling', 'cross-session-leak': 'Checks for information sharing between unrelated sessions', multilingual: 'Translates the input into low-res...
```suggestion mathprompt: 'Encodes input using mathematical concepts and notation', ```
promptfoo
github_2023
typescript
1,885
promptfoo
mldangelo
@@ -102,9 +112,8 @@ export function validateStrategies(strategies: RedteamStrategyObject[]): void { const validStrategiesString = Strategies.map((s) => s.key).join(', '); const invalidStrategiesString = invalidStrategies.map((s) => s.id).join(', '); logger.error( - dedent`Invalid strategy(s): ${inva...
was this change intentional?
promptfoo
github_2023
typescript
1,885
promptfoo
mldangelo
@@ -0,0 +1,181 @@ +import async from 'async'; +import { SingleBar, Presets } from 'cli-progress'; +import dedent from 'dedent'; +import invariant from 'tiny-invariant'; +import { fetchWithCache } from '../../cache'; +import logger from '../../logger'; +import { REQUEST_TIMEOUT_MS } from '../../providers/shared'; +impor...
nit, run this through the formatter
promptfoo
github_2023
others
1,904
promptfoo
mldangelo
@@ -0,0 +1,17 @@ +To get started, set your `WATSONX_AI_APIKEY` or `WATSONX_AI_BEARER_TOKEN`, and `WATSONX_PROJECT_ID` environment variables.
nit, consider telling people where / how to find these
promptfoo
github_2023
others
1,904
promptfoo
mldangelo
@@ -61,7 +61,10 @@ To install the WatsonX provider, use the following steps: 2. Set up the necessary environment variables: ```sh - export WATSONX_API_KEY=your-ibm-cloud-api-key + export WATSONX_AI_APIKEY=your-ibm-cloud-api-key + OR + export WATSONX_AI_BEARER_TOKEN=your-ibm-cloud-bearer-token + expor...
nit have two blocks that someone can copy paste
promptfoo
github_2023
typescript
1,904
promptfoo
mldangelo
@@ -107,8 +107,9 @@ export type EnvVars = { REPLICATE_TOP_P?: number; VOYAGE_API_BASE_URL?: string; VOYAGE_API_KEY?: string; - WATSONX_API_KEY?: string; + WATSONX_AI_APIKEY?: string;
Are you sure you want to rename this? We have WATSONX_ and WATSONX_AI_ as prefixes? Should we pick one or is there reason to have both?
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,115 @@ +--- +sidebar_label: Custom Plugin +--- + +# Custom Plugin + +The Custom Plugin allows you to define your own red teaming plugin with custom generator and grader logic. This flexibility enables you to create specialized tests tailored to your specific AI system and security requirements. + +## Purpose...
this should be yaml
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,115 @@ +--- +sidebar_label: Custom Plugin +--- + +# Custom Plugin + +The Custom Plugin allows you to define your own red teaming plugin with custom generator and grader logic. This flexibility enables you to create specialized tests tailored to your specific AI system and security requirements. + +## Purpose...
yaml
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,115 @@ +--- +sidebar_label: Custom Plugin +--- + +# Custom Plugin + +The Custom Plugin allows you to define your own red teaming plugin with custom generator and grader logic. This flexibility enables you to create specialized tests tailored to your specific AI system and security requirements. + +## Purpose...
what vars are supported?
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,115 @@ +--- +sidebar_label: Custom Plugin +--- + +# Custom Plugin + +The Custom Plugin allows you to define your own red teaming plugin with custom generator and grader logic. This flexibility enables you to create specialized tests tailored to your specific AI system and security requirements. + +## Purpose...
not needed
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,115 @@ +--- +sidebar_label: Custom Plugin +--- + +# Custom Plugin + +The Custom Plugin allows you to define your own red teaming plugin with custom generator and grader logic. This flexibility enables you to create specialized tests tailored to your specific AI system and security requirements. + +## Purpose...
not useful
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,115 @@ +--- +sidebar_label: Custom Plugin +--- + +# Custom Plugin + +The Custom Plugin allows you to define your own red teaming plugin with custom generator and grader logic. This flexibility enables you to create specialized tests tailored to your specific AI system and security requirements. + +## Purpose...
probably not useful either
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,115 @@ +--- +sidebar_label: Custom Plugin +--- + +# Custom Plugin + +The Custom Plugin allows you to define your own red teaming plugin with custom generator and grader logic. This flexibility enables you to create specialized tests tailored to your specific AI system and security requirements. + +## Purpose...
not really applicable
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,135 @@ +--- +sidebar_label: PII +--- + +# PII Plugin + +The PII (Personally Identifiable Information) red teaming plugin is designed to test whether an AI system can be manipulated to disclose or mishandle sensitive personal information. PII refers to any data that could potentially identify a specific indiv...
wonder if we should remove this now that we have a real `cross-session-leak` plugin
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,135 @@ +--- +sidebar_label: PII +--- + +# PII Plugin + +The PII (Personally Identifiable Information) red teaming plugin is designed to test whether an AI system can be manipulated to disclose or mishandle sensitive personal information. PII refers to any data that could potentially identify a specific indiv...
?
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,135 @@ +--- +sidebar_label: PII +--- + +# PII Plugin + +The PII (Personally Identifiable Information) red teaming plugin is designed to test whether an AI system can be manipulated to disclose or mishandle sensitive personal information. PII refers to any data that could potentially identify a specific indiv...
:-1:
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,135 @@ +--- +sidebar_label: PII +--- + +# PII Plugin + +The PII (Personally Identifiable Information) red teaming plugin is designed to test whether an AI system can be manipulated to disclose or mishandle sensitive personal information. PII refers to any data that could potentially identify a specific indiv...
not needed
promptfoo
github_2023
others
1,892
promptfoo
typpo
@@ -0,0 +1,135 @@ +--- +sidebar_label: PII +--- + +# PII Plugin + +The PII (Personally Identifiable Information) red teaming plugin is designed to test whether an AI system can be manipulated to disclose or mishandle sensitive personal information. PII refers to any data that could potentially identify a specific indiv...
not useful
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -20,6 +20,6 @@ "@app/*": ["./src/app/*"] } }, - "include": ["src/", "typings/**/*", "test/"], + "include": ["src/", "typings/**/*", "test/", "watsonx_tiny_test.js"],
```suggestion "include": ["src/", "typings/**/*", "test/"], ```
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -130,6 +131,7 @@ "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@googleapis/sheets": "^9.3.1", + "@ibm-cloud/watsonx-ai": "^1.1.0",
please move this and ibm-cloud-sdk-core below to an optional peer dependency
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -27,7 +27,7 @@ "@mui/icons-material": "^6.1.3", "@segment/ajv-human-errors": "^2.13.0", "clsx": "^2.1.1", - "docusaurus-plugin-image-zoom": "^2.0.0", + "docusaurus-plugin-image-zoom": "^0.1.4",
Don't change the dependencies unless you have a strong reason to. If you have a strong reason, state it. ```suggestion "docusaurus-plugin-image-zoom": "^2.0.0", ```
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -103,6 +105,7 @@ "@types/inquirer": "^9.0.7", "@types/jest": "^29.5.13", "@types/js-yaml": "^4.0.9", + "@types/jspdf": "^2.0.0",
why do we need this, d3-shape, and victory-vendor?
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -0,0 +1,140 @@ +# WatsonX Documentation + +## Introduction + +Discover the potential of **IBM's WatsonX** in your applications with this provider! This provider seamlessly integrates state-of-the-art large language models (LLMs) into your project, empowering you with the powerful **Granite 13B Chat V2** and cutting-...
WatsonX seems to support many more models (granite-20b-multilingual, granite-13b-chat, granite-13b-instruct, granite-34b-code-instruct, granite-20b-code-instruct, granite-8b-code-instruct, granite-3b-code-instruct, granite-8b-japanese, granite-7b-lab, llama-3-2-90b-vision-instruct, llama-3-2-11b-vision-instruct, llama-...
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -0,0 +1,140 @@ +# WatsonX Documentation + +## Introduction + +Discover the potential of **IBM's WatsonX** in your applications with this provider! This provider seamlessly integrates state-of-the-art large language models (LLMs) into your project, empowering you with the powerful **Granite 13B Chat V2** and cutting-...
you can include a yaml snippet for this!
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -0,0 +1,140 @@ +# WatsonX Documentation + +## Introduction + +Discover the potential of **IBM's WatsonX** in your applications with this provider! This provider seamlessly integrates state-of-the-art large language models (LLMs) into your project, empowering you with the powerful **Granite 13B Chat V2** and cutting-...
This is good, but you should think about your audience when writing this. Why would someone use watsonX over any of the other providers? You can tone down the marketing speak a bit and talk about IBM I like this bit from the watsonX overview page IBM [watsonx](https://www.ibm.com/watsonx)™ models are designed fo...
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -0,0 +1,140 @@ +# WatsonX Documentation + +## Introduction + +Discover the potential of **IBM's WatsonX** in your applications with this provider! This provider seamlessly integrates state-of-the-art large language models (LLMs) into your project, empowering you with the powerful **Granite 13B Chat V2** and cutting-...
You didn't include the provider in your example!
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -0,0 +1,140 @@ +# WatsonX Documentation + +## Introduction + +Discover the potential of **IBM's WatsonX** in your applications with this provider! This provider seamlessly integrates state-of-the-art large language models (LLMs) into your project, empowering you with the powerful **Granite 13B Chat V2** and cutting-...
You can probably cut this part as people will get this type of information from the promptfoo guide
promptfoo
github_2023
others
1,869
promptfoo
mldangelo
@@ -0,0 +1,140 @@ +# WatsonX Documentation + +## Introduction + +Discover the potential of **IBM's WatsonX** in your applications with this provider! This provider seamlessly integrates state-of-the-art large language models (LLMs) into your project, empowering you with the powerful **Granite 13B Chat V2** and cutting-...
recommend cutting this
promptfoo
github_2023
typescript
1,869
promptfoo
mldangelo
@@ -0,0 +1,213 @@ +import type { WatsonXAI as WatsonXAIClient } from '@ibm-cloud/watsonx-ai'; +import { WatsonXAI } from '@ibm-cloud/watsonx-ai'; +import { IamAuthenticator } from 'ibm-cloud-sdk-core'; +import { getCache, isCacheEnabled } from '../cache'; +import { getEnvString } from '../envars'; +import logger from '...
You can do more here and validate the required keys in the config. This is a good use case for a zod schema.
promptfoo
github_2023
typescript
1,869
promptfoo
mldangelo
@@ -0,0 +1,213 @@ +import type { WatsonXAI as WatsonXAIClient } from '@ibm-cloud/watsonx-ai'; +import { WatsonXAI } from '@ibm-cloud/watsonx-ai'; +import { IamAuthenticator } from 'ibm-cloud-sdk-core'; +import { getCache, isCacheEnabled } from '../cache'; +import { getEnvString } from '../envars'; +import logger from '...
Can the provider work if this is undefined? if not, change the return type to string and use invariant
promptfoo
github_2023
typescript
1,869
promptfoo
mldangelo
@@ -0,0 +1,213 @@ +import type { WatsonXAI as WatsonXAIClient } from '@ibm-cloud/watsonx-ai'; +import { WatsonXAI } from '@ibm-cloud/watsonx-ai'; +import { IamAuthenticator } from 'ibm-cloud-sdk-core'; +import { getCache, isCacheEnabled } from '../cache'; +import { getEnvString } from '../envars'; +import logger from '...
same comment as on getApiKey
promptfoo
github_2023
typescript
1,869
promptfoo
mldangelo
@@ -0,0 +1,213 @@ +import type { WatsonXAI as WatsonXAIClient } from '@ibm-cloud/watsonx-ai'; +import { WatsonXAI } from '@ibm-cloud/watsonx-ai'; +import { IamAuthenticator } from 'ibm-cloud-sdk-core'; +import { getCache, isCacheEnabled } from '../cache'; +import { getEnvString } from '../envars'; +import logger from '...
You can move this error into getApiKey
promptfoo
github_2023
typescript
1,869
promptfoo
mldangelo
@@ -0,0 +1,213 @@ +import type { WatsonXAI as WatsonXAIClient } from '@ibm-cloud/watsonx-ai'; +import { WatsonXAI } from '@ibm-cloud/watsonx-ai'; +import { IamAuthenticator } from 'ibm-cloud-sdk-core'; +import { getCache, isCacheEnabled } from '../cache'; +import { getEnvString } from '../envars'; +import logger from '...
You can move this error into getModelId()
promptfoo
github_2023
typescript
1,869
promptfoo
mldangelo
@@ -0,0 +1,213 @@ +import type { WatsonXAI as WatsonXAIClient } from '@ibm-cloud/watsonx-ai'; +import { WatsonXAI } from '@ibm-cloud/watsonx-ai'; +import { IamAuthenticator } from 'ibm-cloud-sdk-core'; +import { getCache, isCacheEnabled } from '../cache'; +import { getEnvString } from '../envars'; +import logger from '...
Consider making this ```suggestion apiKey: string; ```
promptfoo
github_2023
typescript
1,869
promptfoo
mldangelo
@@ -0,0 +1,213 @@ +import type { WatsonXAI as WatsonXAIClient } from '@ibm-cloud/watsonx-ai'; +import { WatsonXAI } from '@ibm-cloud/watsonx-ai'; +import { IamAuthenticator } from 'ibm-cloud-sdk-core'; +import { getCache, isCacheEnabled } from '../cache'; +import { getEnvString } from '../envars'; +import logger from '...
this can be removed too
promptfoo
github_2023
typescript
1,869
promptfoo
mldangelo
@@ -0,0 +1,213 @@ +import type { WatsonXAI as WatsonXAIClient } from '@ibm-cloud/watsonx-ai'; +import { WatsonXAI } from '@ibm-cloud/watsonx-ai'; +import { IamAuthenticator } from 'ibm-cloud-sdk-core'; +import { getCache, isCacheEnabled } from '../cache'; +import { getEnvString } from '../envars'; +import logger from '...
Are you sure this will be unique enough? consider caching the whole model config