Skip to content

Commit e6ca141

Browse files
Merge pull request #43 from SasinduDilshara/release-np
Update the client error message
2 parents 8806fc6 + 5b3e58b commit e6ca141

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

ballerina/Ballerina.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
org = "ballerinax"
33
name = "np"
4-
version = "0.8.0"
4+
version = "0.8.1"
55
authors = ["Ballerina"]
66
keywords = ["natural programming", "ai"]
77
repository = "https://github.com/ballerina-platform/module-ballerinax-np"
@@ -17,5 +17,5 @@ observabilityIncluded = true
1717
[[platform.java21.dependency]]
1818
groupId = "io.ballerina.lib"
1919
artifactId = "np-native"
20-
version = "0.8.0"
21-
path = "../native/build/libs/np-native-0.8.0.jar"
20+
version = "0.8.1"
21+
path = "../native/build/libs/np-native-0.8.1-SNAPSHOT.jar"

ballerina/CompilerPlugin.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ id = "np-compiler-plugin"
33
class = "io.ballerina.lib.np.compilerplugin.CompilerPlugin"
44

55
[[dependency]]
6-
path = "../compiler-plugin/build/libs/np-compiler-plugin-0.8.0.jar"
6+
path = "../compiler-plugin/build/libs/np-compiler-plugin-0.8.1-SNAPSHOT.jar"

ballerina/Dependencies.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ modules = [
335335
[[package]]
336336
org = "ballerinax"
337337
name = "np"
338-
version = "0.8.0"
338+
version = "0.8.1"
339339
dependencies = [
340340
{org = "ballerina", name = "http"},
341341
{org = "ballerina", name = "jballerina.java"},

ballerina/main.bal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
const JSON_CONVERSION_ERROR = "FromJsonStringError";
1818
const CONVERSION_ERROR = "ConversionError";
19-
const ERROR_MESSAGE = "Error occurred while converting the LLM response to the given type. Please refine your prompt to get a better result.";
19+
const ERROR_MESSAGE = "Error occurred while attempting to parse the response from the LLM as the expected type. Retrying and/or validating the prompt could fix the response.";
2020

2121
type DefaultModelConfig DefaultAzureOpenAIModelConfig|DefaultOpenAIModelConfig|DefaultBallerinaModelConfig;
2222

@@ -119,7 +119,7 @@ isolated function parseResponseAsType(json resp, typedesc<json> targetType) retu
119119
isolated function handlepParseResponseError(error chatResponseError) returns error {
120120
if chatResponseError.message().includes(JSON_CONVERSION_ERROR)
121121
|| chatResponseError.message().includes(CONVERSION_ERROR) {
122-
return error(string `${ERROR_MESSAGE}`);
122+
return error(string `${ERROR_MESSAGE}`, detail = chatResponseError);
123123
}
124124
return chatResponseError;
125125
}

ballerina/tests/tests.bal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import ballerina/test;
1818

19-
const ERROR_MESSAGE = "Error occurred while converting the LLM response to the given type. Please refine your prompt to get a better result.";
19+
const ERROR_MESSAGE = "Error occurred while attempting to parse the response from the LLM as the expected type. Retrying and/or validating the prompt could fix the response.";
2020

2121
@test:Config
2222
function testPromptAsCodeFunctionWithSimpleExpectedTypeWithDefaultAzureOpenAIClient() returns error? {

0 commit comments

Comments
 (0)