Skip to content

Commit

Permalink
Merge pull request #3366 from continuedev/tomasz/ab-test-timeout
Browse files Browse the repository at this point in the history
AB test showWhateverWeHaveAtXMs
  • Loading branch information
tomasz-stefaniak authored Dec 13, 2024
2 parents ae91c12 + 7434acc commit d2941ae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 1 addition & 5 deletions core/autocomplete/CompletionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ export class CompletionProvider {

// Set temperature (but don't override)
if (llm.completionOptions.temperature === undefined) {
const value = await Telemetry.getValueForFeatureFlag(
PosthogFeatureFlag.AutocompleteTemperature,
);

llm.completionOptions.temperature = value ?? 0.01;
llm.completionOptions.temperature = 0.01;
}

if (llm instanceof OpenAI) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { streamLines } from "../../../diff/util";
import { DEFAULT_AUTOCOMPLETE_OPTS } from "../../../util/parameters";
import { PosthogFeatureFlag, Telemetry } from "../../../util/posthog";
import { HelperVars } from "../../util/HelperVars";

import { stopAtStartOf, stopAtStopTokens } from "./charStream";
Expand Down Expand Up @@ -73,11 +74,14 @@ export class StreamTransformPipeline {
fullStop,
);

lineGenerator = showWhateverWeHaveAtXMs(
lineGenerator,
const timeoutValue =
helper.options.showWhateverWeHaveAtXMs ??
(DEFAULT_AUTOCOMPLETE_OPTS.showWhateverWeHaveAtXMs as number),
);
(await Telemetry.getValueForFeatureFlag(
PosthogFeatureFlag.AutocompleteTimeout,
)) ??
DEFAULT_AUTOCOMPLETE_OPTS.showWhateverWeHaveAtXMs;

lineGenerator = showWhateverWeHaveAtXMs(lineGenerator, timeoutValue!);

const finalGenerator = streamWithNewLines(lineGenerator);
for await (const update of finalGenerator) {
Expand Down
12 changes: 6 additions & 6 deletions core/util/posthog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import { IdeInfo } from "../index.js";
import type { PostHog as PostHogType } from "posthog-node";

export enum PosthogFeatureFlag {
AutocompleteTemperature = "autocomplete-temperature",
AutocompleteTimeout = "autocomplete-timeout",
}

export const EXPERIMENTS: {
[key in PosthogFeatureFlag]: {
[key: string]: { value: number };
};
} = {
[PosthogFeatureFlag.AutocompleteTemperature]: {
control: { value: 0.01 },
"0_33": { value: 0.33 },
"0_66": { value: 0.66 },
"0_99": { value: 0.99 },
[PosthogFeatureFlag.AutocompleteTimeout]: {
control: { value: 150 },
"250": { value: 250 },
"350": { value: 350 },
"450": { value: 450 },
},
};

Expand Down

0 comments on commit d2941ae

Please sign in to comment.