@dataclouder/nest-vertex 0.0.65 → 0.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,6 +37,10 @@ let VertexAdapterLLMController = VertexAdapterLLMController_1 = class VertexAdap
37
37
  return result;
38
38
  }
39
39
  async continueConversation(conversation) {
40
+ if (conversation.returnJson) {
41
+ const result = await this.llmAdapterService.chatAndExtractJson(conversation);
42
+ return result;
43
+ }
40
44
  return this.llmAdapterService.chat(conversation);
41
45
  }
42
46
  };
@@ -38,6 +38,7 @@ export declare class ChatMessageDict {
38
38
  content: string;
39
39
  role: ChatRole;
40
40
  metadata?: any;
41
+ json?: any;
41
42
  }
42
43
  export interface GeneratedTextAdapter {
43
44
  text: string;
@@ -61,6 +61,7 @@ class ChatMessageDict {
61
61
  content;
62
62
  role;
63
63
  metadata;
64
+ json;
64
65
  }
65
66
  exports.ChatMessageDict = ChatMessageDict;
66
67
  class ImageGenAdapterResponse {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataclouder/nest-vertex",
3
- "version": "0.0.65",
3
+ "version": "0.0.66",
4
4
  "description": "NestJS Vertex AI library for Dataclouder",
5
5
  "author": "dataclouder",
6
6
  "license": "MIT",
@@ -8,10 +8,7 @@ export declare class LLMAdapterService implements IModelAdapterMethods {
8
8
  generate(request: ChatLLMRequestAdapter): Promise<any>;
9
9
  private getDefaultModel;
10
10
  chat(request: ChatLLMRequestAdapter): Promise<ChatMessageDict>;
11
- chatAndExtractJson(request: ChatLLMRequestAdapter): Promise<{
12
- json: any;
13
- metadata: any;
14
- }>;
11
+ chatAndExtractJson(request: ChatLLMRequestAdapter): Promise<ChatMessageDict>;
15
12
  private getQualityModel;
16
13
  describeImage(request: DescribeImageRequestAdapter): Promise<GeneratedTextAdapter>;
17
14
  }
@@ -59,7 +59,7 @@ let LLMAdapterService = LLMAdapterService_1 = class LLMAdapterService {
59
59
  if (json === null) {
60
60
  throw new Error('No JSON found in the initial response.');
61
61
  }
62
- return { json, metadata: response.metadata };
62
+ return { ...response, json };
63
63
  }
64
64
  catch (initialError) {
65
65
  const warningMessage = `Initial JSON extraction failed: ${initialError.message}. Attempting recovery.`;
@@ -80,7 +80,7 @@ let LLMAdapterService = LLMAdapterService_1 = class LLMAdapterService {
80
80
  }
81
81
  response.metadata.recovered = true;
82
82
  this.logger.log('Successfully recovered JSON on second attempt.');
83
- return { json: fixedJson, metadata: response.metadata };
83
+ return { ...response, json: fixedJson };
84
84
  }
85
85
  catch (recoveryError) {
86
86
  this.logger.error(`Recovery attempt also failed: ${recoveryError.message}`, recoveryError.stack);