@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
|
};
|
package/models/adapter.models.js
CHANGED
package/package.json
CHANGED
|
@@ -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 {
|
|
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
|
|
83
|
+
return { ...response, json: fixedJson };
|
|
84
84
|
}
|
|
85
85
|
catch (recoveryError) {
|
|
86
86
|
this.logger.error(`Recovery attempt also failed: ${recoveryError.message}`, recoveryError.stack);
|