Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AB test showWhateverWeHaveAtXMs #3366

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions core/autocomplete/CompletionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { PosthogFeatureFlag, Telemetry } from "../util/posthog.js";

import { shouldCompleteMultiline } from "./classification/shouldCompleteMultiline.js";
import { ContextRetrievalService } from "./context/ContextRetrievalService.js";

Check warning on line 9 in core/autocomplete/CompletionProvider.ts

View workflow job for this annotation

GitHub Actions / core-checks

There should be no empty line within import group
// @prettier-ignore

import { BracketMatchingService } from "./filtering/BracketMatchingService.js";
Expand Down Expand Up @@ -72,11 +72,7 @@

// 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 Expand Up @@ -263,7 +259,7 @@

// Save to cache
if (!outcome.cacheHit && helper.options.useCache) {
(await this.autocompleteCache).put(outcome.prefix, outcome.completion);

Check warning on line 262 in core/autocomplete/CompletionProvider.ts

View workflow job for this annotation

GitHub Actions / core-checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
}

// When using the JetBrains extension, Mark as displayed
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
Loading