Skip to content

Commit

Permalink
fix: tool serialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamwhiteuk committed Sep 20, 2024
1 parent 0c3466b commit e0e9095
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/tools/imageDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,29 @@ export class ImageDescriptionTool extends Tool<StringToolOutput, ToolOptions, To
);
}

createSnapshot() {
return {
...super.createSnapshot(),
vllmApiEndpoint: this.vllmApiEndpoint,
vllmApiModelId: this.vllmApiModelId,
openApiKey: this.openApiKey, // pragma: allowlist secret
};
}

loadSnapshot({
vllmApiEndpoint,
vllmApiModelId,
openApiKey,
...snapshot
}: ReturnType<typeof this.createSnapshot>) {
super.loadSnapshot(snapshot);
Object.assign(this, {
vllmApiEndpoint,
vllmApiModelId,
openApiKey,
});
}

protected async queryVllmAPI(completionPrompt: VllmChatCompletionPrompt) {
const vllmApiUrl = new URL("/v1/chat/completions", this.vllmApiEndpoint);
const headers = {
Expand Down

0 comments on commit e0e9095

Please sign in to comment.