@google-cloud/vertexai
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
".": "0.1.0" | ||
".": "0.1.1" | ||
} |
@@ -75,2 +75,3 @@ /** | ||
private location; | ||
private _send_stream_promise; | ||
private historyInternal; | ||
@@ -84,2 +85,3 @@ private _vertex_instance; | ||
sendMessage(request: string | Array<string | Part>): Promise<GenerateContentResult>; | ||
appendHistory(streamGenerateContentResultPromise: Promise<StreamGenerateContentResult>, newContent: Content): Promise<void>; | ||
sendMessageStream(request: string | Array<string | Part>): Promise<StreamGenerateContentResult>; | ||
@@ -86,0 +88,0 @@ } |
@@ -111,2 +111,3 @@ "use strict"; | ||
var _a; | ||
this._send_stream_promise = Promise.resolve(); | ||
this.project = request._vertex_instance.project; | ||
@@ -142,10 +143,3 @@ this.location = request._vertex_instance.location; | ||
} | ||
async sendMessageStream(request) { | ||
const newContent = formulateNewContent(request); | ||
const generateContentrequest = { | ||
contents: this.historyInternal.concat([newContent]), | ||
safety_settings: this.safety_settings, | ||
generation_config: this.generation_config, | ||
}; | ||
const streamGenerateContentResultPromise = this._model_instance.generateContentStream(generateContentrequest); | ||
async appendHistory(streamGenerateContentResultPromise, newContent) { | ||
const streamGenerateContentResult = await streamGenerateContentResultPromise; | ||
@@ -166,2 +160,12 @@ const streamGenerateContentResponse = await streamGenerateContentResult.response; | ||
} | ||
} | ||
async sendMessageStream(request) { | ||
const newContent = formulateNewContent(request); | ||
const generateContentrequest = { | ||
contents: this.historyInternal.concat([newContent]), | ||
safety_settings: this.safety_settings, | ||
generation_config: this.generation_config, | ||
}; | ||
const streamGenerateContentResultPromise = this._model_instance.generateContentStream(generateContentrequest); | ||
this._send_stream_promise = this.appendHistory(streamGenerateContentResultPromise, newContent); | ||
return streamGenerateContentResultPromise; | ||
@@ -168,0 +172,0 @@ } |
# Changelog | ||
## [0.1.1](https://github.com/googleapis/nodejs-vertexai/compare/v0.1.0...v0.1.1) (2023-12-12) | ||
### Bug Fixes | ||
* fix stream send message content ([ad1e17e](https://github.com/googleapis/nodejs-vertexai/commit/ad1e17e81c72ce55d395bcae36326d48d595d175)) | ||
## 0.1.0 (2023-12-12) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "@google-cloud/vertexai", | ||
"description": "Vertex Generative AI client for Node.js", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "author": "Google LLC", |
{ | ||
"initial-version": "0.1.0", | ||
"release-type": "node", | ||
"include-component-in-tag": false, | ||
"packages": { | ||
@@ -5,0 +6,0 @@ ".": {} |
@@ -148,2 +148,3 @@ /** | ||
private location: string; | ||
private _send_stream_promise: Promise<void> = Promise.resolve(); | ||
@@ -199,17 +200,8 @@ private historyInternal: Content[]; | ||
} | ||
async sendMessageStream(request: string|Array<string|Part>): | ||
Promise<StreamGenerateContentResult> { | ||
const newContent: Content = formulateNewContent(request); | ||
const generateContentrequest: GenerateContentRequest = { | ||
contents: this.historyInternal.concat([newContent]), | ||
safety_settings: this.safety_settings, | ||
generation_config: this.generation_config, | ||
}; | ||
const streamGenerateContentResultPromise = | ||
this._model_instance.generateContentStream( | ||
generateContentrequest); | ||
const streamGenerateContentResult = | ||
await streamGenerateContentResultPromise; | ||
async appendHistory( | ||
streamGenerateContentResultPromise: Promise<StreamGenerateContentResult>, | ||
newContent: Content, | ||
): Promise<void> { | ||
const streamGenerateContentResult = await streamGenerateContentResultPromise; | ||
const streamGenerateContentResponse = | ||
@@ -230,3 +222,18 @@ await streamGenerateContentResult.response; | ||
} | ||
} | ||
async sendMessageStream(request: string|Array<string|Part>): | ||
Promise<StreamGenerateContentResult> { | ||
const newContent: Content = formulateNewContent(request); | ||
const generateContentrequest: GenerateContentRequest = { | ||
contents: this.historyInternal.concat([newContent]), | ||
safety_settings: this.safety_settings, | ||
generation_config: this.generation_config, | ||
}; | ||
const streamGenerateContentResultPromise = | ||
this._model_instance.generateContentStream( | ||
generateContentrequest); | ||
this._send_stream_promise = this.appendHistory(streamGenerateContentResultPromise, newContent); | ||
return streamGenerateContentResultPromise; | ||
@@ -233,0 +240,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206992
3448