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
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,127 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +<figure> + <div style={{ textAlign: 'center' }}> + ...
```suggestion - **Test RAG Poisoning**: Test for susceptibility to RAG poisoning with [Promptfoo's RAG poisoning plugin](https://www.promptfoo.dev/docs/red-team/plugins/rag-poisoning/). ```
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,127 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +<figure> + <div style={{ textAlign: 'center' }}> + ...
is the link relevant to "these"?
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,127 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +<figure> + <div style={{ textAlign: 'center' }}> + ...
cool section
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,127 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +<figure> + <div style={{ textAlign: 'center' }}> + ...
text is slightly out of date, mention webui including runner. Platform feels like the wrong word for a local tool
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
```suggestion Data poisoning remains a top concern on the [OWASP Top 10 for 2025](https://owasp.org/www-project-top-10-for-large-language-model-applications/). However, the scope of data poisoning has expanded since the 2023 version. Data poisoning is no longer strictly a risk during the training of Large Language Mod...
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
can you please take another pass at this section?
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
i know this is a different list from the one in your intro but it is similar enough that it's confusing to me (there's overlap). maybe not an actionable nit but wanted to share.
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
rephrase
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
how does this make sense in an LLM context?
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
You should be more specific here. I don't understand what this means as an LLM application developer.
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
consider rephrasing. I am not sure if this is useful detail in this article. It may be table stakes.
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
pre-deployment evals with promptfoo! consider stating this first.
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
Is this the right level of detail for your audience?
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
this is good
promptfoo
github_2023
others
2,566
promptfoo
mldangelo
@@ -0,0 +1,118 @@ +--- +sidebar_label: Defending Against Data Poisoning Attacks on LLMs—A Comprehensive Guide +image: /img/blog/data-poisoning/poisoning-panda.jpeg +date: 2025-01-07 +--- + +# Defending Against Data Poisoning Attacks on LLMs: A Comprehensive Guide + +Data poisoning remains a top concern on the [OWASP To...
not just related to hugging face this can be run on any output. model is hosted on hugging face
promptfoo
github_2023
typescript
2,996
promptfoo
ellipsis-dev[bot]
@@ -60,49 +141,205 @@ export class WebSocketProvider implements ApiProvider { return `[WebSocket Provider ${this.url}]`; } + private async closeWebSocket(): Promise<void> { + return new Promise<void>((resolve) => { + if (!this.context.ws) { + resolve(); + return; + } + + // If...
Wrap the callApi logic in a try/catch so that connection errors (e.g. from connect()) return a ProviderResponse with an error property instead of rejecting the promise. This aligns with test expectations (e.g., 'should handle WebSocket errors').
promptfoo
github_2023
typescript
2,996
promptfoo
github-advanced-security[bot]
@@ -12,41 +12,122 @@ const nunjucks = getNunjucksEngine(); +const DEFAULT_TIMEOUT = 30000; // 30 seconds +const CONNECTION_TIMEOUT = 5000; // 5 seconds + interface WebSocketProviderConfig { messageTemplate: string; url?: string; - timeoutMs?: number; + timeoutMs?: number; // Document that this defaults to...
## Code injection This code execution depends on a [user-provided value](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/76)
promptfoo
github_2023
typescript
2,996
promptfoo
ellipsis-dev[bot]
@@ -28,22 +31,86 @@ export function createTransformResponse(parser: any): (data: any) => ProviderRes return parser; } if (typeof parser === 'string') { - return new Function('data', `return ${parser}`) as (data: any) => ProviderResponse; + // Wrap in an IIFE to allow multiple statements + const fn =...
Default setOrUpdateVars returns an empty object rather than preserving existing vars. Consider returning the passed vars.
promptfoo
github_2023
others
2,996
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,67 @@ +# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json + +# Define the prompt template +prompts: + - id: chat-prompt + label: Chat Message + raw: '{{ question }}' + +# Define the provider configuration +providers: + - id: websocket + config: + type: websocket + u...
Consider returning the sessionId consistently. Currently, you return `{ vars, sessionId }`, but if `vars.sessionId` was already defined, `sessionId` might be undefined. Use `sessionId: vars.sessionId` instead.
promptfoo
github_2023
typescript
2,996
promptfoo
ellipsis-dev[bot]
@@ -61,10 +129,19 @@ export class WebSocketProvider implements ApiProvider { } async callApi(prompt: string, context?: CallApiContextParams): Promise<ProviderResponse> { - const vars = { - ...(context?.vars || {}), - prompt, - }; + logger.debug(`Calling WebSocket provider ${this.url} with pro...
Remove or replace the console.log with a logger call. Direct console calls may leak sensitive data in production. ```suggestion logger.info(`Updated context: ${safeJsonStringify(updatedContext)}`); ```
promptfoo
github_2023
others
2,996
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,51 @@ +# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json +description: Local Websocket Conversation Example +targets: + - id: websocket + label: promptfoo-redpanda-websocket-proxy + config: + type: websocket + url: ws://localhost:4000 + messageTemplate: '{"prompt"...
Bug: Missing 'return result' in transformResponse block.
promptfoo
github_2023
others
2,996
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,51 @@ +# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json +description: Local Websocket Conversation Example +targets: + - id: websocket + label: promptfoo-redpanda-websocket-proxy + config: + type: websocket + url: ws://localhost:4000 + messageTemplate: '{"prompt"...
Potential bug in setSessionContext: 'sessionId' remains undefined if vars.sessionId exists. Consider initializing 'sessionId' from vars. ```suggestion let sessionId = vars.sessionId || undefined; ```
promptfoo
github_2023
typescript
3,413
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,1159 @@ +import { getEnvFloat, getEnvInt, getEnvString } from '../envars'; +import logger from '../logger'; +import telemetry from '../telemetry'; +import type { + ApiEmbeddingProvider, + ApiProvider, + CallApiContextParams, + CallApiOptionsParams, + ProviderEmbeddingResponse, + ProviderResponse, +} fr...
Use the existing `sleep` utility function from `time.ts` instead of creating a new one. - function `sleep` ([time.ts](https://github.com/promptfoo/promptfoo/blob/c7a29d78f8a53d13a73a33ff78ae2bf1f1c02ba7/src/util/time.ts#L5-L5))
promptfoo
github_2023
typescript
3,406
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,147 @@ +import type Anthropic from '@anthropic-ai/sdk'; +import { APIError } from '@anthropic-ai/sdk'; +import { getCache, isCacheEnabled } from '../../cache'; +import { getEnvInt, getEnvFloat } from '../../envars'; +import logger from '../../logger'; +import type { ProviderResponse } from '../../types'; +im...
Avoid use of the non-null assertion `!` in `this.id = options.id ? () => options.id! : () => ...`. Instead, perform an explicit check or use conditional logic to safely handle undefined IDs.
promptfoo
github_2023
others
3,406
promptfoo
ellipsis-dev[bot]
@@ -4,8 +4,8 @@ description: Code generation with sandboxed verification prompts: code_generation_prompt.txt providers: - - openai:gpt-4 - - anthropic:messages:claude-3-5-sonnet-20241022 + - openai:gpt-4o
In the providers section, 'openai:gpt-4o' in line 7 appears to have an extra 'o' (possibly a typo). If this is not intentional, consider changing it back to 'openai:gpt-4'. ```suggestion - openai:gpt-4 ```
promptfoo
github_2023
typescript
3,406
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,143 @@ +import type { DefaultProviders, ProviderResponse } from '../../types'; +import type { EnvOverrides } from '../../types/env'; +import { AnthropicMessagesProvider } from './messages'; + +// Default model to use for all default providers +export const DEFAULT_ANTHROPIC_MODEL = 'claude-3-7-sonnet-2025021...
Avoid using the non-null assertion operator `!` here. Instead, check if the value exists or throw an error if the factory unexpectedly returns undefined.
promptfoo
github_2023
typescript
3,406
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,143 @@ +import type { DefaultProviders, ProviderResponse } from '../../types'; +import type { EnvOverrides } from '../../types/env'; +import { AnthropicMessagesProvider } from './messages'; + +// Default model to use for all default providers +export const DEFAULT_ANTHROPIC_MODEL = 'claude-3-7-sonnet-2025021...
Consider normalizing the env object (e.g., sorting its keys) before JSON stringification to ensure a consistent cache key. ```suggestion const cacheKey = env ? JSON.stringify(Object.keys(env).sort().reduce((obj, key) => { obj[key] = env[key]; return obj; }, {})) : ''; ```
promptfoo
github_2023
typescript
3,406
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,143 @@ +import type { DefaultProviders, ProviderResponse } from '../../types'; +import type { EnvOverrides } from '../../types/env'; +import { AnthropicMessagesProvider } from './messages'; + +// Default model to use for all default providers +export const DEFAULT_ANTHROPIC_MODEL = 'claude-3-7-sonnet-2025021...
For consistency, consider standardizing how `env` is passed to provider constructors. Here, `env` is passed directly for `AnthropicLlmRubricProvider`, whereas other factories wrap it in an object (e.g., `{ env }`). ```suggestion (env?: EnvOverrides) => new AnthropicLlmRubricProvider(DEFAULT_ANTHROPIC_MODEL, { env }),...
promptfoo
github_2023
others
3,412
promptfoo
ellipsis-dev[bot]
@@ -186,6 +186,86 @@ redteam: This example use a custom policy plugin that generates test cases based on specific rules. +## Testing Individual Agent Steps + +LLM agents often operate as multi-step workflows, with distinct phases like planning, reasoning, tool selection, and execution. Testing the entire agent end...
Duplicate YAML keys: Multiple `plugins:` keys under one `redteam:` block can result in key overriding. Consider merging all plugins into a single list.
promptfoo
github_2023
others
3,412
promptfoo
ellipsis-dev[bot]
@@ -410,13 +410,141 @@ Note that you should adapt this approach to fill the context window for your app This red team will ensure that the application behaves correctly even with a bunch of a junk filling its context. +## Testing Individual RAG Components + +RAG systems consist of two primary components: retrieval...
Variable mismatch: `test_context` is used instead of the defined `TEST_CONTEXT` in `generation_only_provider.py` example. ```suggestion "test_context": TEST_CONTEXT, ```
promptfoo
github_2023
others
3,411
promptfoo
ellipsis-dev[bot]
@@ -3,24 +3,22 @@ description: 'Bedrock Claude Eval' prompts: - 'Write a tweet about {{topic}}' providers: - - id: bedrock:us.anthropic.claude-3-5-haiku-20241022-v1:0 - label: Claude 3.5 Haiku v1 + - id: bedrock:us.anthropic.claude-3-7-sonnet-20250219-v1:0
Duplicate provider ID detected. Both providers use the same id `bedrock:us.anthropic.claude-3-7-sonnet-20250219-v1:0`, which might lead to conflicts.
promptfoo
github_2023
typescript
3,383
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,1011 @@ +import WebSocket from 'ws'; +import { OpenAiGenericProvider } from '.'; +import logger from '../../logger'; +import type { + CallApiContextParams, + CallApiOptionsParams, + ProviderResponse, + TokenUsage, +} from '../../types'; +import type { EnvOverrides } from '../../types/env'; +import { rend...
The methods `webSocketRequest` and `directWebSocketRequest` share a lot of duplicated logic (e.g. setting up WebSocket options, timeouts, handling events). Consider refactoring common parts into a helper function to improve maintainability.
promptfoo
github_2023
typescript
3,383
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,326 @@ +import WebSocket from 'ws'; +import { disableCache, enableCache } from '../../../src/cache'; +import logger from '../../../src/logger'; +import { OpenAiRealtimeProvider } from '../../../src/providers/openai/realtime'; + +// Mock WebSocket +jest.mock('ws'); +const MockWebSocket = WebSocket as jest.Moc...
Consider adding tests for when the `functionCallHandler` rejects or throws an error.
promptfoo
github_2023
typescript
3,405
promptfoo
ellipsis-dev[bot]
@@ -24,6 +24,8 @@ export async function extractEntities(provider: ApiProvider, prompts: string[]): ${formatPrompts(prompts)} + DO NOT include prompt template roles such as "system", "developer, "user", "assistant", or other conversation roles as entities.
Typo in prompt string: Missing a closing quote after `'developer'`. It should read: `"system", "developer", "user", "assistant"`. ```suggestion DO NOT include prompt template roles such as "system", "developer", "user", "assistant", or other conversation roles as entities. ```
promptfoo
github_2023
others
3,404
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,399 @@ +--- +description: Guidelines for updating Docusaurus documentation following best practices +globs: 'site/docs/**/*.md,site/docs/**/*.mdx,site/blog/**/*.md,site/blog/**/*.mdx,site/src/pages/**/*.md,site/src/pages/**/*.mdx' +alwaysApply: false +--- + +# Docusaurus Documentation Guidelines + +Files: "s...
Typographical error: The admonition examples use four colons (e.g., `::::note`) while the documentation guidelines state that admonitions should be wrapped with three colons (e.g., `:::note`). Correct these examples for consistency.
promptfoo
github_2023
others
3,404
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,399 @@ +--- +description: Guidelines for updating Docusaurus documentation following best practices +globs: 'site/docs/**/*.md,site/docs/**/*.mdx,site/blog/**/*.md,site/blog/**/*.mdx,site/src/pages/**/*.md,site/src/pages/**/*.mdx' +alwaysApply: false +--- + +# Docusaurus Documentation Guidelines + +Files: "s...
Typographical error: The external resource URL in the 'See Also' section is written as 'mdc:https:/example.com' (with a single slash after 'https:'). It should probably be 'mdc:https://example.com'. ```suggestion - [External Resource](mdc:https://example.com) ```
promptfoo
github_2023
others
3,403
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,411 @@ +--- +sidebar_label: Testing Guardrails +--- + +# Testing and Validating Guardrails + +Guardrails are security filters that help protect your AI applications from misuse. This guide explains how to test and validate guardrails with Promptfoo to ensure they're working effectively. + +:::note
Possible typo: extra colon in admonition syntax. Should be `:::note` instead of `::::note`. ```suggestion :::note ```
promptfoo
github_2023
javascript
3,403
promptfoo
mldangelo
@@ -111,6 +111,7 @@ const sidebars = { link: { type: 'generated-index', }, + collapsed: true,
nice
promptfoo
github_2023
others
3,394
promptfoo
ellipsis-dev[bot]
@@ -1,25 +1,55 @@ -# DeepSeek Red Team Example +# redteam-deepseek-foundation (DeepSeek Red Team Example) -This example demonstrates how to run a red team evaluation using Promptfoo against DeepSeek-R1 and GPT-4o-mini. The repository includes several key files: +This example demonstrates how to run a red team evaluat...
Inconsistent model naming: the README mentions `GPT-4o-mini` while the config uses `GPT-4o`. Please align the naming to avoid confusion.
promptfoo
github_2023
typescript
3,389
promptfoo
github-advanced-security[bot]
@@ -0,0 +1,153 @@ +import { fetchWithProxy } from '../../src/fetch'; +import { CloudConfig, cloudConfig, API_HOST } from '../../src/globalConfig/cloud'; +import { readGlobalConfig, writeGlobalConfigPartial } from '../../src/globalConfig/globalConfig'; +import logger from '../../src/logger'; + +jest.mock('../../src/fetc...
## Hard-coded credentials The hard-coded value "invalid-token" is used as [authorization header](1). [Show more details](https://github.com/promptfoo/promptfoo/security/code-scanning/88)
promptfoo
github_2023
typescript
3,374
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,1072 @@ +import { getEnvFloat, getEnvInt, getEnvString } from '../envars'; +import logger from '../logger'; +import telemetry from '../telemetry'; +import type { + ApiEmbeddingProvider, + ApiProvider, + CallApiContextParams, + CallApiOptionsParams, + ProviderEmbeddingResponse, + ProviderResponse +} fr...
Inline transform functions are evaluated using `new Function()`. Although a warning is provided, consider caching the compiled transform function or verifying its source so that repeated evaluations don’t incur performance overhead and to further mitigate security risks.
promptfoo
github_2023
typescript
3,379
promptfoo
ellipsis-dev[bot]
@@ -33,6 +35,20 @@ function AssertionResults({ gradingResults }: { gradingResults?: GradingResult[] setExpandedValues((prev) => ({ ...prev, [index]: !prev[index] })); }; + const copyAssertionToClipboard = async (
Consider wrapping the call to `navigator.clipboard.writeText` in a `try/catch` block to handle potential errors when copying text. This pattern should be applied consistently in both `copyAssertionToClipboard` and `copyFieldToClipboard` functions.
promptfoo
github_2023
typescript
3,379
promptfoo
ellipsis-dev[bot]
@@ -145,47 +222,106 @@ <Dialog open={open} onClose={onClose} fullWidth maxWidth="lg"> <DialogTitle>Details{provider && `: ${provider}`}</DialogTitle> <DialogContent> - <Box mb={2}> + <Box + mb={2} + position="relative" + onMouseEnter={() => setHoveredElement('...
For accessibility, consider adding an `aria-label` to each `IconButton` (copy button) so assistive technologies have contextual information about the button's purpose.
promptfoo
github_2023
typescript
3,379
promptfoo
ellipsis-dev[bot]
@@ -216,10 +352,37 @@ <TableRow key={key}> <TableCell>{key}</TableCell> <TableCell - style={{ whiteSpace: 'pre-wrap', cursor: 'pointer' }} + style={{ + whiteSpace: 'pre-w...
The inline styles for `IconButtons` (e.g., `backgroundColor`, position settings) are repeated throughout the file. Consider extracting these style objects or using MUI's `sx` prop for consistency and ease of maintenance.
promptfoo
github_2023
typescript
3,379
promptfoo
ellipsis-dev[bot]
@@ -22,6 +22,8 @@ function AssertionResults({ gradingResults }: { gradingResults?: GradingResult[] }) { const [expandedValues, setExpandedValues] = useState<{ [key: number]: boolean }>({}); + const [copiedAssertions, setCopiedAssertions] = useState<{ [key: string | number]: boolean }>({});
Consider using a consistent key type for the copied state (e.g. always a string) in `copiedAssertions`. Currently some keys are numbers and others are strings, which may lead to confusion.
promptfoo
github_2023
typescript
3,362
promptfoo
mldangelo
@@ -765,6 +765,7 @@ export const AWS_BEDROCK_MODELS: Record<string, IBedrockModel> = { 'meta.llama3-1-8b-instruct-v1:0': BEDROCK_MODEL.LLAMA3_1, 'meta.llama3-70b-instruct-v1:0': BEDROCK_MODEL.LLAMA3, 'meta.llama3-8b-instruct-v1:0': BEDROCK_MODEL.LLAMA3, + 'meta.llama3-2-3b-instruct-v1:0': BEDROCK_MODEL.LLAMA3...
Are you sure this model is available as is? If so we should probably add all of the other llama 3.2s and 3.3s as well. Related: https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html
promptfoo
github_2023
typescript
3,372
promptfoo
ellipsis-dev[bot]
@@ -1094,6 +1094,7 @@ export const pluginDescriptions: Record<Plugin, string> = { }; export const strategyDescriptions: Record<Strategy, string> = { + audio: 'Tests detection and handling of audio-based malicious payloads',
Added 'audio' strategy description. Ensure this key is also included in the `ALL_STRATEGIES` (or similar union) so it’s available system-wide.
promptfoo
github_2023
typescript
3,366
promptfoo
ellipsis-dev[bot]
@@ -114,5 +114,13 @@ export const GRADERS: Record<RedteamAssertionTypes, RedteamGraderBase> = { }; export function getGraderById(id: string): RedteamGraderBase | undefined { - return GRADERS[id as keyof typeof GRADERS]; + // First try to get the exact grader + const grader = GRADERS[id as keyof typeof GRADERS];
Avoid using a type assertion here. Instead of `id as keyof typeof GRADERS`, consider using a runtime check like `if (id in GRADERS)` to ensure the key exists. ```suggestion const grader = id in GRADERS ? GRADERS[id] : undefined; ```
promptfoo
github_2023
typescript
3,370
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,1034 @@ +import { getEnvFloat, getEnvInt, getEnvString } from '../envars'; +import logger from '../logger'; +import telemetry from '../telemetry'; +import type { + ApiEmbeddingProvider, + ApiProvider, + CallApiContextParams, + CallApiOptionsParams, + ProviderEmbeddingResponse, + ProviderOptions, + Pr...
Consider handling the case where an inline transform function returns falsy but valid result (empty string or zero); current code checks for null but may lose intentional falsy values.
promptfoo
github_2023
typescript
3,371
promptfoo
ellipsis-dev[bot]
@@ -195,7 +195,16 @@ const RiskCategoryDrawer: React.FC<RiskCategoryDrawerProps> = ({ color="inherit" fullWidth onClick={(event) => { - const url = `/eval/?evalId=${evalId}&search=${encodeURIComponent(`(var=${categoryName}|metric=${categoryName})`)}`; + // Check if...
This search query generation logic is duplicated. Consider extracting to a shared utility function that both components can use. - Search query generation in TestSuites ([TestSuites.tsx](https://github.com/promptfoo/promptfoo/blob/c16b1badc7534972d62530e3cfbc7729f3056d13/src/app/src/pages/redteam/report/components/Tes...
promptfoo
github_2023
typescript
3,369
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,994 @@ +import { getEnvFloat, getEnvInt, getEnvString } from '../envars'; +import logger from '../logger'; +import telemetry from '../telemetry'; +import type { + ApiEmbeddingProvider, + ApiProvider, + CallApiContextParams, + CallApiOptionsParams, + ProviderEmbeddingResponse, + ProviderOptions, + Pro...
Be cautious using `new Function()` for inline transform functions—it can be a security risk if transform content comes from untrusted sources.
promptfoo
github_2023
typescript
3,369
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,994 @@ +import { getEnvFloat, getEnvInt, getEnvString } from '../envars'; +import logger from '../logger'; +import telemetry from '../telemetry'; +import type { + ApiEmbeddingProvider, + ApiProvider, + CallApiContextParams, + CallApiOptionsParams, + ProviderEmbeddingResponse, + ProviderOptions, + Pro...
Consider not reassigning the existing `id` method. Instead, explicitly store a custom provider ID (e.g., in a separate property) to avoid confusion with the class method.
promptfoo
github_2023
typescript
3,369
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,994 @@ +import { getEnvFloat, getEnvInt, getEnvString } from '../envars'; +import logger from '../logger'; +import telemetry from '../telemetry'; +import type { + ApiEmbeddingProvider, + ApiProvider, + CallApiContextParams, + CallApiOptionsParams, + ProviderEmbeddingResponse, + ProviderOptions, + Pro...
Cache keys are built by stringifying the entire prompt and config. Consider hashing these values to avoid excessively long keys and potential performance issues.
promptfoo
github_2023
typescript
3,368
promptfoo
ellipsis-dev[bot]
@@ -322,6 +325,30 @@ function ResultsTable({ return false; } + // Special handling for metadata= searches + if (searchText && searchText.startsWith('metadata=') && searchText.includes(':')) { + // Extract key and value from metadata search + const [_, me...
In the metadata search block, splitting by `:` may fail if the metadata value contains additional colons. Consider more robust parsing or adding invariant checks to ensure proper format.
promptfoo
github_2023
typescript
3,368
promptfoo
ellipsis-dev[bot]
@@ -322,6 +325,30 @@ return false; } + // Special handling for metadata= searches + if (searchText && searchText.startsWith('metadata=') && searchText.includes(':')) { + // Extract key and value from metadata search + const [_, metadataQuery] = searchTex...
After splitting the search text for metadata (using 'metadata=' and ':'), consider trimming whitespace from both the metadata key and value. This can help avoid mismatches when the input query has unintended spaces. ```suggestion const [metadataKey, metadataValue] = metadataQuery.split(':').map(s => s.trim(...
promptfoo
github_2023
typescript
3,368
promptfoo
ellipsis-dev[bot]
@@ -331,7 +358,26 @@ output.gradingResult?.reason || '' } ${output.gradingResult?.comment || ''}`; - const searchString = `${vars} ${stringifiedOutput}`; + // Include metadata in search if available + const metadataString = output.metada...
The logic to generate the metadata search string (by iterating over `Object.entries` and stringifying values) is repeated in multiple places. Consider extracting this into a helper function to reduce code duplication and improve maintainability.
promptfoo
github_2023
typescript
3,368
promptfoo
ellipsis-dev[bot]
@@ -322,7 +339,35 @@ function ResultsTable({ return false; } - return searchText && searchRegex + // Special handling for metadata= searches + if ( + debouncedSearchText && + debouncedSearchText.startsWith('metadata=') && + debouncedS...
After splitting the metadata query, consider trimming `metadataKey` and `metadataValue` to remove extraneous whitespace. This helps ensure accurate matching even if the user includes spaces. ```suggestion const [metadataKey, metadataValue] = metadataQuery.split(':').map(s => s.trim()); ```
promptfoo
github_2023
typescript
3,368
promptfoo
ellipsis-dev[bot]
@@ -275,14 +278,28 @@ ); const columnVisibilityIsSet = Object.keys(columnVisibility).length > 0; + + const [localDebouncedSearchText] = useDebounce(searchText, 200); + const debouncedSearchText = externalDebouncedSearchText || localDebouncedSearchText; + const [isSearching, setIsSearching] = useState(false);...
When creating the regex from `debouncedSearchText`, the catch block only logs the error. Consider providing user feedback (or another fallback) for invalid regex inputs to improve UX. ```suggestion showToast('Invalid regular expression. Please check your input.', 'error'); ```
promptfoo
github_2023
typescript
3,363
promptfoo
ellipsis-dev[bot]
@@ -732,6 +737,94 @@ export const BEDROCK_MODEL = { }, output: (responseJson: any) => responseJson?.outputs[0]?.text, }, + DEEPSEEK: { + params: (config: BedrockDeepseekGenerationOptions, prompt: string) => {
The DEEPSEEK params logic for parsing the prompt is similar to the AMAZON_NOVA block. Consider refactoring this repeated JSON parsing and message extraction into a shared helper to improve maintainability.
promptfoo
github_2023
typescript
3,363
promptfoo
ellipsis-dev[bot]
@@ -732,6 +737,94 @@ }, output: (responseJson: any) => responseJson?.outputs[0]?.text, }, + DEEPSEEK: { + params: (config: BedrockDeepseekGenerationOptions, prompt: string) => { + let messages; + let systemPrompt; + try { + const parsed = JSON.parse(prompt); + if (Array.isA...
Avoid using the `any` type for `params` and `inferenceConfig`. Consider defining explicit types to enhance type safety.
promptfoo
github_2023
typescript
3,363
promptfoo
mldangelo
@@ -797,13 +893,15 @@ export const AWS_BEDROCK_MODELS: Record<string, IBedrockModel> = { 'eu.anthropic.claude-3-5-sonnet-20240620-v1:0': BEDROCK_MODEL.CLAUDE_MESSAGES, 'eu.anthropic.claude-3-haiku-20240307-v1:0': BEDROCK_MODEL.CLAUDE_MESSAGES, 'eu.anthropic.claude-3-sonnet-20240229-v1:0': BEDROCK_MODEL.CLAUDE_...
I am 99% sure this doesn't exist
promptfoo
github_2023
others
3,350
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,118 @@ +--- +sidebar_label: 'Sensitive Information Disclosure' +image: /img/blog/sensitive-information-disclosure/memorization_pandas.png +date: 2025-03-11 +--- + +# Sensitive Information Disclosure in LLMs: Privacy and Compliance in Generative AI + +Imagine deploying an LLM application only to discover it's...
Rephrase unclear text: 'Restricted is memorized' is ambiguous. Consider clarifying what is memorized. ```suggestion In many ways, sensitive information disclosure can be considered a model-layer risk. Restricted information is memorized by the model and can subsequently be regurgitated during inference. Controls such a...
promptfoo
github_2023
others
3,350
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,118 @@ +--- +sidebar_label: 'Sensitive Information Disclosure' +image: /img/blog/sensitive-information-disclosure/memorization_pandas.png +date: 2025-03-11 +--- + +# Sensitive Information Disclosure in LLMs: Privacy and Compliance in Generative AI + +Imagine deploying an LLM application only to discover it's...
Typo detected: 'exploitably' should likely be 'exploitability' or rephrased. ```suggestion All LLMs are vulnerable to sensitive information disclosure. The risk depends on the level of exploitability based on how jailbreakable the model is and the types of controls that are in place during deployment. This risk can be ...
promptfoo
github_2023
typescript
3,364
promptfoo
ellipsis-dev[bot]
@@ -26,39 +26,41 @@ const CustomMetrics: React.FC<CustomMetricsProps> = ({ return ( <div className="custom-metric-container" data-testid="custom-metrics"> - {displayMetrics.map(([metric, score]) => - metric && typeof score !== 'undefined' ? ( - <span - key={metric} - ...
Consider sorting the entire metrics list (i.e. before slicing) if you expect all metrics to be alphabetically ordered. Also, memoize the sorted array (e.g. with `useMemo`) to avoid re-sorting on every render.
promptfoo
github_2023
typescript
3,356
promptfoo
ellipsis-dev[bot]
@@ -655,7 +633,7 @@ const StrategyStats: React.FC<StrategyStatsProps> = ({ </Typography> <StyledGrid> {strategies.map(([strategy, { pass, total }]) => { - const failRate = ((total - pass) / total) * 100; + const failRate = 100 - ((total - pass) / total) * 100...
The calculation `100 - ((total - pass) / total) * 100` equals `(pass/total)*100`. Consider renaming `failRate` to clarify its meaning and add a guard to prevent division by zero.
promptfoo
github_2023
typescript
3,356
promptfoo
coderabbitai[bot]
@@ -108,7 +108,7 @@ const RiskCard: React.FC<{ }} /> </Box> - <Typography variant="h6" className="risk-card-issues"> + <Typography variant="h6" sx={{ color: numTestsFailed === 0 ? '#888888' : 'red' }}>
_🧹 Nitpick (assertive)_ **Consider using theme palette colors for consistency** You're directly using hex values to color "failed probes". For better maintainability and consistent theming, consider using the theme's palette (e.g., `theme.palette.error.main`) or color tokens. This approach preserves a coherent look-...
promptfoo
github_2023
typescript
3,356
promptfoo
coderabbitai[bot]
@@ -146,6 +150,76 @@ const App: React.FC = () => { return passes; }, [evalData]); + const categoryStats = React.useMemo(() => { + if (!evalData) { + return {}; + } + + return evalData.results.results.reduce( + (acc, row) => { + const pluginId = getPluginIdFromResult(row); + i...
_🧹 Nitpick (assertive)_ **Clarify the rationale behind passWithFilter** While this code effectively tracks total passes and filtered passes, the variable name `passWithFilter` could benefit from a short comment explaining its purpose (e.g., partial successes under moderation rules). This helps maintain clarity for f...
promptfoo
github_2023
typescript
3,345
promptfoo
ellipsis-dev[bot]
@@ -150,6 +150,7 @@ export class GoogleMMLiveProvider implements ApiProvider { }, this.config.timeoutMs || 10000); let response_text_total = ''; + const function_calls_total: string[] = [];
Type mismatch: `function_calls_total` is declared as `string[]` but receives object values. Update its type (e.g., to an array of `FunctionCall`) to reflect the data pushed. ```suggestion const function_calls_total: FunctionCall[] = []; ```
promptfoo
github_2023
typescript
3,345
promptfoo
ellipsis-dev[bot]
@@ -190,12 +191,29 @@ response_text_total = response_text_total + response.serverContent.modelTurn.parts[0].text; } else if (response.toolCall?.functionCalls) { - resolve({ output: JSON.stringify(response) }); - ws.close(); - } else if (response.serv...
Ensure that function call objects include all properties expected downstream (e.g., an `id` field). If `id` is part of the expected data (as seen in tests), update the `FunctionCall` interface accordingly.
promptfoo
github_2023
typescript
3,345
promptfoo
ellipsis-dev[bot]
@@ -118,14 +120,163 @@ describe('GoogleMMLiveProvider', () => { }),
The tests use multiple `setTimeout` calls to simulate asynchronous WebSocket messages. Consider refactoring these into helper functions or a controlled timing mechanism to reduce duplication and potential flakiness.
promptfoo
github_2023
others
3,361
promptfoo
ellipsis-dev[bot]
@@ -4,49 +4,106 @@ sidebar_label: Image Inputs # Image Jailbreaking -The Image strategy converts prompt text into an image and then encodes that image as a base64 string. This allows for testing how AI systems handle image-encoded text, which may potentially bypass text-based content filters or lead to different b...
Typographical issue: The markdown note and tip block markers use four colons (e.g., `::::note`, `::::tip`) instead of the standard three (i.e., `:::note`, `:::tip`). Please update these block markers (at lines 62, 88, 92, 96, etc.) to use three colons for proper markdown rendering.
promptfoo
github_2023
typescript
3,361
promptfoo
ellipsis-dev[bot]
@@ -13,14 +13,23 @@ function escapeXml(unsafe: string): string { .replace(/'/g, '&apos;'); } +// Cache for the sharp module to avoid repeated dynamic imports +let sharpCache: any = null;
Specify a proper type for `sharpCache` instead of using `any` to improve type safety. ```suggestion let sharpCache: typeof import('sharp') | null = null; ```
promptfoo
github_2023
typescript
3,347
promptfoo
mldangelo
@@ -0,0 +1,184 @@ +import { SingleBar, Presets } from 'cli-progress'; +import logger from '../../logger'; +import type { TestCase } from '../../types'; +import invariant from '../../util/invariant'; + +declare module 'node-gtts' { + export default function gtts(lang: string): { + stream(text: string): NodeJS.Readab...
this line does nothing?
promptfoo
github_2023
typescript
3,342
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,94 @@ +import { createCanvas } from 'canvas'; +import logger from '../../logger'; +import type { TestCase } from '../../types'; +import invariant from '../../util/invariant'; + +/** + * Converts text to an image and then to base64 + * @param text The text to convert + * @returns Base64 encoded PNG image of t...
Using a fixed canvas height (`400`) may cause text overflow for longer inputs. Consider dynamically computing the canvas height based on the text.
promptfoo
github_2023
typescript
3,342
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,106 @@ +import { SingleBar, Presets } from 'cli-progress'; +import sharp from 'sharp'; +import logger from '../../logger'; +import type { TestCase } from '../../types'; +import invariant from '../../util/invariant'; + +// Helper function to escape XML special characters for SVG +function escapeXml(unsafe: st...
Consider updating the fallback in the catch block to include the `data:image/png;base64,` prefix for consistency with successful results. ```suggestion return `data:image/png;base64,${Buffer.from(text).toString('base64')}`; ```
promptfoo
github_2023
typescript
3,342
promptfoo
mldangelo
@@ -0,0 +1,106 @@ +import { SingleBar, Presets } from 'cli-progress'; +import sharp from 'sharp'; +import logger from '../../logger'; +import type { TestCase } from '../../types'; +import invariant from '../../util/invariant'; + +// Helper function to escape XML special characters for SVG +function escapeXml(unsafe: st...
instead of requiring sharp we could put this into our backend or even use a service like quickchart
promptfoo
github_2023
typescript
3,343
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,40 @@ +import type { ApiProvider, ProviderOptions, ProviderResponse } from '../types/providers'; + +export class EchoProvider implements ApiProvider { + private options: ProviderOptions; + + constructor(options: ProviderOptions = {}) { + this.options = options; + this.id = options.id ? () => options....
Avoid reassigning the instance method `id` to a new function. Consider storing the custom id in a separate property (e.g., `this.customId`) and returning that in the `id()` method. This improves clarity and avoids potential pitfalls with method inheritance.
promptfoo
github_2023
typescript
3,343
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,54 @@ +import type { ApiProvider, ProviderOptions, ProviderResponse } from '../types/providers'; +import { sleep } from '../util/time'; + +export class EchoProvider implements ApiProvider { + private options: ProviderOptions; + + public label?: string; + public config?: any; + public delay?: number; + p...
Missing assignment for `transform`. The property `transform` is declared but not assigned from options in the constructor. Consider adding: `this.transform = options.transform;`
promptfoo
github_2023
typescript
3,343
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,130 @@ +import { EchoProvider } from '../../src/providers/echo'; + +describe('EchoProvider', () => { + describe('constructor', () => { + it('should initialize with default options', () => { + const provider = new EchoProvider(); + expect(provider['options']).toEqual({}); + expect(provider....
Consider asserting the `transform` property if it's expected to be initialized from options. ```suggestion transform: 'return { output: input.toUpperCase() };', ```
promptfoo
github_2023
typescript
3,341
promptfoo
ellipsis-dev[bot]
@@ -146,7 +146,13 @@ export async function getTargetResponse( }; } - throw new Error('Expected target output or error to be set'); + throw new Error( + `
Avoid extra indentation/newlines in multi-line error strings; consider using a dedent helper or string concatenation to ensure the error message doesn't include unintended whitespace.
promptfoo
github_2023
others
3,338
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,2 @@ +You are a helpful but somewhat poetic assistant. +Please provide information about {{ topic }} in the style of a haiku.
Missing newline at end of file. Please add a final newline to conform to typical style conventions.
promptfoo
github_2023
typescript
3,338
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,21 @@ +import * as fs from 'fs'; +import type { Prompt } from '../../types'; + +/** + * Processes a Jinja2 template file to extract prompts. + * Similar to markdown files, each Jinja2 file is treated as a single prompt. + * + * @param filePath - Path to the Jinja2 template file. + * @param prompt - The raw p...
Consider adding error handling around `fs.readFileSync` to manage potential file read errors, ensuring robustness like in other processors.
promptfoo
github_2023
typescript
3,334
promptfoo
ellipsis-dev[bot]
@@ -32,8 +32,9 @@ interface AzureCompletionOptions { azureTenantId?: string; azureAuthorityHost?: string; azureTokenScope?: string; + // @deprecated use max_completion_tokens instead
Update the deprecation comment for `'o1'` to mention it's for legacy models; the new phrasing on `max_completion_tokens` suggests it's for reasoning models. ```suggestion // @deprecated use max_completion_tokens instead; 'o1' is for legacy models ```
promptfoo
github_2023
typescript
3,334
promptfoo
ellipsis-dev[bot]
@@ -582,7 +583,7 @@ export class AzureChatCompletionProvider extends AzureGenericProvider { top_p: config.top_p ?? getEnvFloat('OPENAI_TOP_P', 1), presence_penalty: config.presence_penalty ?? getEnvFloat('OPENAI_PRESENCE_PENALTY', 0), frequency_penalty: config.frequency_penalty ?? getEnvFloat('OPEN...
The conditional now only checks for `config.o1` or `config.reasoning_effort`. Confirm that omitting `max_completion_tokens` in the condition is intended even if a user sets it without `reasoning_effort`.
promptfoo
github_2023
typescript
3,332
promptfoo
ellipsis-dev[bot]
@@ -548,12 +558,29 @@ export class AzureCompletionProvider extends AzureGenericProvider { } catch (err) { return { error: `API response error: ${String(err)}: ${JSON.stringify(data)}`, + tokenUsage: cached + ? { + cached: data.usage.total_tokens, + total: d...
Consider adding a deprecation warning log if the deprecated `o1` flag is used, to help users migrate to the preferred `isReasoningModel` flag.
promptfoo
github_2023
typescript
3,332
promptfoo
ellipsis-dev[bot]
@@ -576,21 +603,33 @@ } : {}; + // Check if this is configured as a reasoning model + const isReasoningModel = this.isReasoningModel(); + + // Get max tokens based on model type + const maxTokens = config.max_tokens ?? getEnvInt('OPENAI_MAX_TOKENS', 1024); + const maxCompletionTokens = ...
Document inline in `getOpenAiBody` that temperature is omitted for reasoning models, to clarify that its exclusion is intentional.
promptfoo
github_2023
typescript
3,221
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,39 @@ +import cliState from '../src/cliState'; + +describe('cliState', () => { + // Reset cliState before and after each test + beforeEach(() => {
Consider abstracting the reset logic for repeated deletion of properties in beforeEach and afterEach to a helper function in tests to avoid duplication.
promptfoo
github_2023
typescript
3,221
promptfoo
ellipsis-dev[bot]
@@ -9,6 +9,9 @@ interface CliState { // Indicates we're running in web UI mode webUI?: boolean; + + // Indicates we're running redteam mode + isRedteam?: boolean;
Typographical consistency: Consider renaming the property 'isRedteam' (and updating the corresponding comment) to 'isRedTeam' to adhere to camelCase conventions.
promptfoo
github_2023
typescript
3,221
promptfoo
ellipsis-dev[bot]
@@ -568,15 +568,27 @@ export class VertexChatProvider extends VertexGenericProvider { } if ('promptFeedback' in data[0] && data[0].promptFeedback?.blockReason) { - if (cliState.config?.redteam) { + const defaultTokenUsage = { + total: 0, + prompt: 0, + ...
Inconsistent type for `cached`: changed from boolean to number. Other parts expect a boolean flag when returning cached responses. ```suggestion cached: false, ```
promptfoo
github_2023
typescript
3,329
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,109 @@ +import React from 'react'; +import { Box, Typography, Stack, useTheme, Paper, alpha } from '@mui/material'; +import { tokens } from '../tokens'; + +interface SettingsSectionProps { + title: string; + children: React.ReactNode; + icon?: React.ReactNode; + description?: string; +} + +const Settings...
The `role` attribute is mistakenly placed inside the `sx` prop (line 99). For proper accessibility, move `role="list"` out of the `sx` object and pass it directly as a prop to the `Box`.
promptfoo
github_2023
typescript
3,329
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,72 @@ +/** + * Design tokens for ResultsViewSettings components
The header comment refers to 'ResultsViewSettings components', which seems inconsistent with the file location (TableSettings). Consider updating the comment to accurately reflect the component context (e.g., 'TableSettings' if appropriate). ```suggestion * Design tokens for TableSettings components ```
promptfoo
github_2023
typescript
3,303
promptfoo
ellipsis-dev[bot]
@@ -53,7 +54,29 @@ export function redteamRunCommand(program: Command) { if (opts.config && UUID_REGEX.test(opts.config)) { const configObj = await getConfigFromCloud(opts.config); + const provider = await getProviderModelFromCloud(configObj.provider); + + // if the provider is stateful,...
Avoid using 'as any' for strategy.id. Update StrategyConfig to properly type id to improve type safety.
promptfoo
github_2023
typescript
3,303
promptfoo
ellipsis-dev[bot]
@@ -52,39 +69,29 @@ export async function getConfigFromCloud(id: string) { ); } try { - const response = await makeRequest(`api/redteam/configs/${id}`, 'GET'); - const body = await response.json(); - if (response.ok) { - logger.info(`Config fetched from cloud: ${id}`); - logger.debug(`Conf...
Missing `response.ok` check for the unified config endpoint. Consider checking `response.ok` before parsing JSON for consistency with the non-unified branch. ```suggestion if (response.ok) { const body = await response.json(); } else { throw new Error(`Failed to fetch config from cloud: ${response.statusText}`); ...
promptfoo
github_2023
typescript
3,303
promptfoo
ellipsis-dev[bot]
@@ -18,22 +20,37 @@ }); } +export async function targetApiBuildDate(): Promise<Date | null> { + try { + const response = await makeRequest('version', 'GET'); + + const data = await response.json(); + + const { buildDate } = data; + logger.debug(`[targetApiBuildDate] ${buildDate}`); + if (buildDate...
The provider fetch call does not verify `response.ok` before parsing JSON. Adding a similar check as in the config fetch (else branch) would improve error handling consistency.
promptfoo
github_2023
typescript
3,303
promptfoo
ellipsis-dev[bot]
@@ -19,6 +21,28 @@ export function makeRequest(path: string, method: string, body?: any): Promise<R }); } +export async function targetApiBuildDate(): Promise<Date | null> { + try { + const response = await makeRequest('version', 'GET'); + + const data = await response.json(); + + const { buildDate } = ...
Consider adding an explicit return type to `cloudCanBuildFormattedConfig` for clarity (e.g., `Promise<boolean>`). ```suggestion async function cloudCanBuildFormattedConfig(): Promise<boolean> { ```
promptfoo
github_2023
typescript
3,303
promptfoo
ellipsis-dev[bot]
@@ -46,53 +63,36 @@ } } -interface CloudConfig { - id: string; - config: SavedRedteamConfig; - createdAt: string; - updatedAt: string; -} - -export async function getConfigFromCloud(id: string): Promise<CloudConfig> { +export async function getConfigFromCloud(id: string): Promise<UnifiedConfig> { if (!clou...
Add a `response.ok` check in the unified config branch of `getConfigFromCloud` to ensure error conditions are handled as in the fallback branch.
promptfoo
github_2023
typescript
3,303
promptfoo
ellipsis-dev[bot]
@@ -19,6 +21,28 @@ }); } +export async function targetApiBuildDate(): Promise<Date | null> {
Consider caching the result of `targetApiBuildDate` to avoid multiple API calls if the build date remains stable.
promptfoo
github_2023
typescript
3,303
promptfoo
ellipsis-dev[bot]
@@ -28,13 +52,13 @@ export async function getProviderFromCloud(id: string): Promise<ProviderOptions try { const response = await makeRequest(`api/providers/${id}`, 'GET'); - const body = await response.json(); - if (response.ok) { - logger.info(`Provider fetched from cloud: ${id}`); - logger.d...
Consider including the status code (e.g. `response.status`) in the error message for more context. ```suggestion throw new Error(`Failed to fetch provider from cloud: ${response.statusText} (Status Code: ${response.status})`); ```
promptfoo
github_2023
others
3,326
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,194 @@ +--- +description: This rule provides guidance for creating and maintaining examples in the promptfoo project, which has an extensive collection of example configurations. +globs: examples/**/* +alwaysApply: false +--- + +# Examples Development Guidelines + +## Example Structure + +- Each example shou...
Extraneous code fence marker detected. Please check if the closing fence on line 26 is intentional. ```suggestion ```
promptfoo
github_2023
others
3,326
promptfoo
ellipsis-dev[bot]
@@ -0,0 +1,194 @@ +--- +description: This rule provides guidance for creating and maintaining examples in the promptfoo project, which has an extensive collection of example configurations. +globs: examples/**/* +alwaysApply: false +--- + +# Examples Development Guidelines + +## Example Structure + +- Each example shou...
Typo: Remove the extraneous apostrophe at the end of the description for the 'env' field. ```suggestion 2. `env` (optional) - Environment variable settings. Only define if absolutely necessary ```