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

Add an experiments flag to enable ai logging in the server #1380

Merged
merged 1 commit into from
May 28, 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: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,12 @@
"scope": "window",
"markdownDescription": "Relative path to a file within the workspace to open within a Runme notebook view, when VS Code starts (e.g. `./CONTRIBUTING.md`)."
},
"runme.experiments.aiLogs": {
"type": "boolean",
"scope": "window",
"default": false,
"markdownDescription": "If set to `true`, enable logging server logs used for training AIs."
},
"runme.experiments.escalationButton": {
"type": "boolean",
"scope": "window",
Expand Down
3 changes: 3 additions & 0 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@ export class RunmeExtension {
const grpcSerializer = kernel.hasExperimentEnabled('grpcSerializer')
const grpcServer = kernel.hasExperimentEnabled('grpcServer')
const grpcRunner = kernel.hasExperimentEnabled('grpcRunner')
const aiLogs = kernel.hasExperimentEnabled('aiLogs')

const server = new RunmeServer(
context.extensionUri,
{
retryOnFailure: true,
maxNumberOfIntents: 10,
aiLogs: aiLogs,
},
!grpcServer,
grpcRunner,
Expand Down
1 change: 1 addition & 0 deletions src/extension/kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export class Kernel implements Disposable {
this.#experiments.set('grpcServer', config.get<boolean>('grpcServer', true))
this.#experiments.set('escalationButton', config.get<boolean>('escalationButton', false))
this.#experiments.set('smartEnvStore', config.get<boolean>('smartEnvStore', false))
this.#experiments.set('aiLogs', config.get<boolean>('aiLogs', false))

this.cellManager = new NotebookCellManager(this.#controller)
this.#controller.supportsExecutionOrder = getNotebookExecutionOrder()
Expand Down
8 changes: 8 additions & 0 deletions src/extension/server/runmeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface IServerConfig {
intents: number
interval: number
}
aiLogs?: boolean
}

const log = getLogger('RunmeServer')
Expand Down Expand Up @@ -64,6 +65,7 @@ class RunmeServer implements IServer {
#transport?: GrpcTransport
#serverDisposables: Disposable[] = []
#forceExternalServer: boolean
#aiLogs: boolean

readonly #onClose = this.register(new EventEmitter<{ code: number | null }>())
readonly #onTransportReady = this.register(
Expand Down Expand Up @@ -94,6 +96,7 @@ class RunmeServer implements IServer {
this.#acceptsIntents = options.acceptsConnection?.intents || 50
this.#acceptsInterval = options.acceptsConnection?.interval || 200
this.#forceExternalServer = externalServer
this.#aiLogs = options.aiLogs || false
}

dispose() {
Expand Down Expand Up @@ -232,6 +235,11 @@ class RunmeServer implements IServer {
args.push('--runner')
}

if (this.#aiLogs) {
log.info('AI logs enabled')
args.push('--ai-logs=true')
}

if (getTLSEnabled()) {
args.push('--tls', this.getTLSDir())
} else {
Expand Down
Loading