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

fix: improve performance in AI request logging #14769

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent {
const requestId = generateUuid();
const request: LanguageModelRequest = {
messages: [{ type: 'text', actor: 'user', query: prompt }],
settings: {
stream: false
}
};
if (token.isCancellationRequested) {
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const languageModelOutputHandler = (
'Sending request:'
);
const formattedRequest = formatJsonWithIndentation(args[0]);
formattedRequest.forEach(line => outputChannel.appendLine(line));
outputChannel.append(formattedRequest.join('\n'));
if (args[1]) {
args[1] = new Proxy(args[1], {
get<CK extends keyof CancellationToken>(
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-openai/src/node/openai-language-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class OpenAiModel implements LanguageModel {
const settings = this.getSettings(request);
const openai = this.initializeOpenAi();

if (this.isNonStreamingModel(this.model)) {
if (this.isNonStreamingModel(this.model) || (typeof settings.stream === 'boolean' && !settings.stream)) {
return this.handleNonStreamingRequest(openai, request);
}

Expand Down
Loading