From af87d1f7c67f0f67f73a861b9baa2f75e693bce2 Mon Sep 17 00:00:00 2001 From: MohamedSabthar Date: Tue, 21 Oct 2025 16:40:55 +0530 Subject: [PATCH 1/5] Add tracing to model provider --- ballerina/model-provider.bal | 64 ++++++++++++++++++++++-- ballerina/provider_utils.bal | 95 ++++++++++++++++++++++++------------ ballerina/types.bal | 8 +++ 3 files changed, 132 insertions(+), 35 deletions(-) diff --git a/ballerina/model-provider.bal b/ballerina/model-provider.bal index bb3b365..7c0280a 100644 --- a/ballerina/model-provider.bal +++ b/ballerina/model-provider.bal @@ -15,6 +15,7 @@ // under the License. import ballerina/ai; +import ballerina/ai.observe; import ballerina/http; import ballerina/jballerina.java; import ballerina/time; @@ -86,7 +87,21 @@ public isolated client class ModelProvider { # + return - Function to be called, chat response or an error in-case of failures isolated remote function chat(ai:ChatMessage[]|ai:ChatUserMessage messages, ai:ChatCompletionFunctions[] tools, string? stop = ()) returns ai:ChatAssistantMessage|ai:Error { - DeepSeekChatRequestMessages[] deepseekPayloadMessages = check self.prepareDeepseekRequestMessages(messages); + observe:ChatSpan span = observe:createChatSpan(self.modelType); + span.addProvider("deepseek"); + if stop is string { + span.addStopSequence(stop); + } + span.addTemperature(self.temperature); + json|ai:Error inputMessage = convertMessageToJson(messages); + if inputMessage is json { + span.addInputMessages(inputMessage); + } + DeepSeekChatRequestMessages[]|ai:Error deepseekPayloadMessages = self.prepareDeepseekRequestMessages(messages); + if deepseekPayloadMessages is ai:Error { + span.close(deepseekPayloadMessages); + return deepseekPayloadMessages; + } DeepSeekChatCompletionRequest request = { temperature: self.temperature, @@ -97,6 +112,7 @@ public isolated client class ModelProvider { }; if tools.length() > 0 { + span.addTools(tools); DeepseekFunction[] deepseekFunctions = []; foreach ai:ChatCompletionFunctions toolFunction in tools { map? parameters = toolFunction.parameters; @@ -118,18 +134,45 @@ public isolated client class ModelProvider { DeepSeekChatCompletionResponse|error response = self.llmClient->/chat/completions.post(request); if response is error { - return error ai:LlmConnectionError("Error while connecting to the model", response); + ai:Error err = error ai:LlmConnectionError("Error while connecting to the model", response); + span.close(err); + return err; + } + + span.addResponseId(response.id); + int? inputTokens = response.usage?.prompt_tokens; + if inputTokens is int { + span.addInputTokenCount(inputTokens); + } + int? outputTokens = response.usage?.completion_tokens; + if outputTokens is int { + span.addOutputTokenCount(outputTokens); + } + + DeepseekChatResponseChoice[]? choices = response.choices; + string? finishReason = choices !is () && choices.length() > 0 ? choices[0].finish_reason : (); + if finishReason is string { + span.addFinishReason(finishReason); } - return self.getAssistantMessages(response); + ai:ChatAssistantMessage|ai:Error result = self.getAssistantMessages(response); + if result is ai:Error { + span.close(result); + return result; + } + + span.addOutputMessages(result); + span.addOutputType(observe:TEXT); + span.close(); + return result; } # Sends a chat request to the model and generates a value that belongs to the type # corresponding to the type descriptor argument. - # + # # + prompt - The prompt to use in the chat messages # + td - Type descriptor specifying the expected return type format # + return - Generates a value that belongs to the type, or an error if generation fails - isolated remote function generate(ai:Prompt prompt, @display {label: "Expected type"} typedesc td = <>) + isolated remote function generate(ai:Prompt prompt, @display {label: "Expected type"} typedesc td = <>) returns td|ai:Error = @java:Method { 'class: "io.ballerina.lib.ai.deepseek.Generator" } external; @@ -307,3 +350,14 @@ isolated function getChatMessageStringContent(ai:Prompt|string prompt) returns s } return promptStr.trim(); } + +isolated function convertMessageToJson(ai:ChatMessage[]|ai:ChatMessage messages) returns json|ai:Error { + if messages is ai:ChatMessage[] { + return messages.'map(msg => msg is ai:ChatUserMessage|ai:ChatSystemMessage ? check convertMessageToJson(msg) : msg); + } + if messages is ai:ChatUserMessage|ai:ChatSystemMessage { + + } + return messages !is ai:ChatUserMessage|ai:ChatSystemMessage ? messages : + {role: messages.role, content: check getChatMessageStringContent(messages.content), name: messages.name}; +} diff --git a/ballerina/provider_utils.bal b/ballerina/provider_utils.bal index 99edc8f..9c4a17a 100644 --- a/ballerina/provider_utils.bal +++ b/ballerina/provider_utils.bal @@ -15,6 +15,7 @@ // under the License. import ballerina/ai; +import ballerina/ai.observe; import ballerina/http; type ResponseSchema record {| @@ -83,17 +84,17 @@ isolated function getGetResultsToolChoice() returns DeepSeekToolChoice => { } }; -isolated function getGetResultsTool(map parameters) returns DeepseekTool[]|error => +isolated function getGetResultsTool(map parameters) returns DeepseekTool[] => [ - { - 'type: FUNCTION, - 'function: { - name: GET_RESULTS_TOOL, - parameters: parameters, - description: "Tool to call with the response from a large language model (LLM) for a user prompt." - } + { + 'type: FUNCTION, + 'function: { + name: GET_RESULTS_TOOL, + parameters: parameters, + description: "Tool to call with the response from a large language model (LLM) for a user prompt." } - ]; + } +]; isolated function generateChatCreationContent(ai:Prompt prompt) returns string|ai:Error { string[] & readonly strings = prompt.strings; @@ -110,8 +111,8 @@ isolated function generateChatCreationContent(ai:Prompt prompt) returns string|a if insertion is ai:TextDocument[] { foreach ai:TextDocument doc in insertion { - promptStr += doc.content + " "; - + promptStr += doc.content + " "; + } promptStr += str; continue; @@ -136,18 +137,27 @@ isolated function handleParseResponseError(error chatResponseError) returns erro isolated function generateLlmResponse(http:Client llmClient, int maxTokens, DEEPSEEK_MODEL_NAMES modelType, decimal temperature, ai:Prompt prompt, typedesc expectedResponseTypedesc) returns anydata|ai:Error { - string content = check generateChatCreationContent(prompt); - ResponseSchema ResponseSchema = check getExpectedResponseSchema(expectedResponseTypedesc); - DeepseekTool[]|error tools = getGetResultsTool(ResponseSchema.schema); - if tools is error { - return error("Error in generated schema: " + tools.message()); + observe:GenerateContentSpan span = observe:createGenerateContentSpan(modelType); + span.addProvider("deepseek"); + + string content; + ResponseSchema responseSchema; + do { + content = check generateChatCreationContent(prompt); + responseSchema = check getExpectedResponseSchema(expectedResponseTypedesc); + } on fail ai:Error err { + span.close(err); + return err; } + DeepseekTool[] tools = getGetResultsTool(responseSchema.schema); + if tools is error { + ai:Error err = error("Error in generated schema: " + tools.message()); + span.close(err); + return err; + } - DeepseekChatUserMessage[] messages = [{ - role: ai:USER, - content - }]; + DeepseekChatUserMessage[] messages = [{role: ai:USER, content}]; DeepSeekChatCompletionRequest request = { messages, model: modelType, @@ -156,42 +166,67 @@ isolated function generateLlmResponse(http:Client llmClient, int maxTokens, DEEP tools, toolChoice: getGetResultsToolChoice() }; + span.addInputMessages(messages); DeepSeekChatCompletionResponse|error response = llmClient->/chat/completions.post(request); if response is error { - return error ai:LlmConnectionError("Error while connecting to the model", response); + ai:Error err = error ai:LlmConnectionError("Error while connecting to the model", response); + span.close(err); + return err; } - DeepseekChatResponseChoice[]? choices = response.choices; + span.addResponseId(response.id); + int? inputTokens = response.usage?.prompt_tokens; + if inputTokens is int { + span.addInputTokenCount(inputTokens); + } + int? outputTokens = response.usage?.completion_tokens; + if outputTokens is int { + span.addOutputTokenCount(outputTokens); + } + DeepseekChatResponseChoice[]? choices = response.choices; if choices is () || choices.length() == 0 { - return error("No completion choices"); + ai:Error err = error("No completion choices"); + span.close(err); + return err; } DeepseekChatResponseMessage message = choices[0].message; DeepseekChatResponseToolCall[]? toolCalls = message?.tool_calls; - if toolCalls is () || toolCalls.length() == 0 { - return error(NO_RELEVANT_RESPONSE_FROM_THE_LLM); + if toolCalls is () || toolCalls.length() == 0 { + ai:Error err = error(NO_RELEVANT_RESPONSE_FROM_THE_LLM); + span.close(err); + return err; } DeepseekChatResponseToolCall toolCall = toolCalls[0]; map|error arguments = toolCall.'function.arguments.fromJsonStringWithType(); if arguments is error { - return error(NO_RELEVANT_RESPONSE_FROM_THE_LLM); + ai:Error err = error(NO_RELEVANT_RESPONSE_FROM_THE_LLM); + span.close(err); + return err; } anydata|error res = parseResponseAsType(arguments.toJsonString(), expectedResponseTypedesc, - ResponseSchema.isOriginallyJsonObject); + responseSchema.isOriginallyJsonObject); if res is error { - return error ai:LlmInvalidGenerationError(string `Invalid value returned from the LLM Client, expected: '${ + ai:Error err = error ai:LlmInvalidGenerationError(string `Invalid value returned from the LLM Client, expected: '${ expectedResponseTypedesc.toBalString()}', found '${res.toBalString()}'`); + span.close(err); + return err; } anydata|error result = res.ensureType(expectedResponseTypedesc); - if result is error { - return error ai:LlmInvalidGenerationError(string `Invalid value returned from the LLM Client, expected: '${ + ai:Error err = error ai:LlmInvalidGenerationError(string `Invalid value returned from the LLM Client, expected: '${ expectedResponseTypedesc.toBalString()}', found '${(typeof response).toBalString()}'`); + span.close(err); + return err; } + + span.addOutputMessages(result.toJson()); + span.addOutputType(observe:JSON); + span.close(); return result; } diff --git a/ballerina/types.bal b/ballerina/types.bal index 2f932a8..548eac0 100644 --- a/ballerina/types.bal +++ b/ballerina/types.bal @@ -102,11 +102,19 @@ type DeepseekChatResponseMessage record { type DeepseekChatResponseChoice record { DeepseekChatResponseMessage message; + string finish_reason?; }; +// https://api-docs.deepseek.com/api/create-chat-completion#responses type DeepSeekChatCompletionResponse record { string id; DeepseekChatResponseChoice[] choices; + DeepSeekUsage usage?; +}; + +type DeepSeekUsage record { + int prompt_tokens; + int completion_tokens; }; type DeepseekChatSystemMessage record {| From fc02b3629c6b016157344d8b326069a25321f27d Mon Sep 17 00:00:00 2001 From: MohamedSabthar Date: Tue, 21 Oct 2025 16:43:34 +0530 Subject: [PATCH 2/5] Bump minor version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index df22949..5bbc77c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ org.gradle.caching=true group=io.ballerina.lib -version=1.0.4-SNAPSHOT +version=1.1.0-SNAPSHOT ballerinaLangVersion=2201.12.0 shadowJarPluginVersion=8.1.1 From f2b5a044d9f8384cc53181f85b27ef95a76d60c0 Mon Sep 17 00:00:00 2001 From: MohamedSabthar Date: Tue, 21 Oct 2025 16:43:52 +0530 Subject: [PATCH 3/5] [Automated] Update the toml files --- ballerina/Ballerina.toml | 12 +++++++++--- ballerina/CompilerPlugin.toml | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 1f7e0d9..c4b0b52 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -7,7 +7,7 @@ icon="icon.png" name = "ai.deepseek" org = "ballerinax" repository = "https://github.com/ballerina-platform/module-ballerinax-ai.deepseek" -version = "1.0.4" +version = "1.1.0" [platform.java21] graalvmCompatible = true @@ -15,5 +15,11 @@ graalvmCompatible = true [[platform.java21.dependency]] groupId = "io.ballerina.lib" artifactId = "ai.deepseek-native" -version = "1.0.4" -path = "../native/build/libs/ai.deepseek-native-1.0.4-SNAPSHOT.jar" +version = "1.1.0" +path = "../native/build/libs/ai.deepseek-native-1.1.0-SNAPSHOT.jar" + +[[dependency]] +org="ballerina" +name="ai" +version="1.6.0" +repository="local" \ No newline at end of file diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index e818523..936cad5 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,7 +3,7 @@ id = "ai-deepseek-compiler-plugin" class = "io.ballerina.lib.ai.deepseek.AiDeepseekCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/ai.deepseek-compiler-plugin-1.0.4-SNAPSHOT.jar" +path = "../compiler-plugin/build/libs/ai.deepseek-compiler-plugin-1.1.0-SNAPSHOT.jar" [[dependency]] path = "../compiler-plugin/build/libs/ballerina-to-openapi-2.3.0.jar" From 3b5b248b932ae69020ae03a131988c43b8538877 Mon Sep 17 00:00:00 2001 From: MohamedSabthar Date: Tue, 21 Oct 2025 16:46:00 +0530 Subject: [PATCH 4/5] [Automated] Update the toml files --- ballerina/Dependencies.toml | 403 ------------------------------------ 1 file changed, 403 deletions(-) delete mode 100644 ballerina/Dependencies.toml diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml deleted file mode 100644 index e1efd7a..0000000 --- a/ballerina/Dependencies.toml +++ /dev/null @@ -1,403 +0,0 @@ -# AUTO-GENERATED FILE. DO NOT MODIFY. - -# This file is auto-generated by Ballerina for managing dependency versions. -# It should not be modified by hand. - -[ballerina] -dependencies-toml-version = "2" -distribution-version = "2201.12.0" - -[[package]] -org = "ballerina" -name = "ai" -version = "1.5.4" -dependencies = [ - {org = "ballerina", name = "constraint"}, - {org = "ballerina", name = "data.jsondata"}, - {org = "ballerina", name = "data.xmldata"}, - {org = "ballerina", name = "file"}, - {org = "ballerina", name = "http"}, - {org = "ballerina", name = "io"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.array"}, - {org = "ballerina", name = "lang.regexp"}, - {org = "ballerina", name = "lang.runtime"}, - {org = "ballerina", name = "log"}, - {org = "ballerina", name = "math.vector"}, - {org = "ballerina", name = "mcp"}, - {org = "ballerina", name = "mime"}, - {org = "ballerina", name = "time"}, - {org = "ballerina", name = "url"}, - {org = "ballerina", name = "uuid"}, - {org = "ballerina", name = "yaml"} -] -modules = [ - {org = "ballerina", packageName = "ai", moduleName = "ai"}, - {org = "ballerina", packageName = "ai", moduleName = "ai.intelligence"} -] - -[[package]] -org = "ballerina" -name = "auth" -version = "2.14.0" -dependencies = [ - {org = "ballerina", name = "crypto"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.array"}, - {org = "ballerina", name = "lang.string"}, - {org = "ballerina", name = "log"} -] - -[[package]] -org = "ballerina" -name = "cache" -version = "3.10.0" -dependencies = [ - {org = "ballerina", name = "constraint"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "task"}, - {org = "ballerina", name = "time"} -] - -[[package]] -org = "ballerina" -name = "constraint" -version = "1.7.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "crypto" -version = "2.9.1" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "time"} -] - -[[package]] -org = "ballerina" -name = "data.jsondata" -version = "1.1.2" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.object"} -] - -[[package]] -org = "ballerina" -name = "data.xmldata" -version = "1.5.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.object"} -] - -[[package]] -org = "ballerina" -name = "file" -version = "1.12.0" -dependencies = [ - {org = "ballerina", name = "io"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "os"}, - {org = "ballerina", name = "time"} -] - -[[package]] -org = "ballerina" -name = "http" -version = "2.14.6" -dependencies = [ - {org = "ballerina", name = "auth"}, - {org = "ballerina", name = "cache"}, - {org = "ballerina", name = "constraint"}, - {org = "ballerina", name = "crypto"}, - {org = "ballerina", name = "data.jsondata"}, - {org = "ballerina", name = "file"}, - {org = "ballerina", name = "io"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "jwt"}, - {org = "ballerina", name = "lang.array"}, - {org = "ballerina", name = "lang.decimal"}, - {org = "ballerina", name = "lang.int"}, - {org = "ballerina", name = "lang.regexp"}, - {org = "ballerina", name = "lang.runtime"}, - {org = "ballerina", name = "lang.string"}, - {org = "ballerina", name = "lang.value"}, - {org = "ballerina", name = "log"}, - {org = "ballerina", name = "mime"}, - {org = "ballerina", name = "oauth2"}, - {org = "ballerina", name = "observe"}, - {org = "ballerina", name = "time"}, - {org = "ballerina", name = "url"} -] -modules = [ - {org = "ballerina", packageName = "http", moduleName = "http"}, - {org = "ballerina", packageName = "http", moduleName = "http.httpscerr"} -] - -[[package]] -org = "ballerina" -name = "io" -version = "1.8.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.value"} -] - -[[package]] -org = "ballerina" -name = "jballerina.java" -version = "0.0.0" -modules = [ - {org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "jwt" -version = "2.15.1" -dependencies = [ - {org = "ballerina", name = "cache"}, - {org = "ballerina", name = "crypto"}, - {org = "ballerina", name = "io"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.int"}, - {org = "ballerina", name = "lang.string"}, - {org = "ballerina", name = "log"}, - {org = "ballerina", name = "time"} -] - -[[package]] -org = "ballerina" -name = "lang.__internal" -version = "0.0.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.object"} -] - -[[package]] -org = "ballerina" -name = "lang.array" -version = "0.0.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.__internal"} -] - -[[package]] -org = "ballerina" -name = "lang.decimal" -version = "0.0.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "lang.error" -version = "0.0.0" -scope = "testOnly" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "lang.int" -version = "0.0.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.__internal"}, - {org = "ballerina", name = "lang.object"} -] - -[[package]] -org = "ballerina" -name = "lang.object" -version = "0.0.0" - -[[package]] -org = "ballerina" -name = "lang.regexp" -version = "0.0.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "lang.runtime" -version = "0.0.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "lang.string" -version = "0.0.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.regexp"} -] - -[[package]] -org = "ballerina" -name = "lang.value" -version = "0.0.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "log" -version = "2.13.0" -dependencies = [ - {org = "ballerina", name = "io"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.value"}, - {org = "ballerina", name = "observe"} -] - -[[package]] -org = "ballerina" -name = "math.vector" -version = "1.2.0" - -[[package]] -org = "ballerina" -name = "mcp" -version = "1.0.0" -dependencies = [ - {org = "ballerina", name = "http"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "uuid"} -] - -[[package]] -org = "ballerina" -name = "mime" -version = "2.12.0" -dependencies = [ - {org = "ballerina", name = "io"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.int"}, - {org = "ballerina", name = "log"} -] - -[[package]] -org = "ballerina" -name = "oauth2" -version = "2.14.1" -dependencies = [ - {org = "ballerina", name = "cache"}, - {org = "ballerina", name = "crypto"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "log"}, - {org = "ballerina", name = "time"}, - {org = "ballerina", name = "url"} -] - -[[package]] -org = "ballerina" -name = "observe" -version = "1.5.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "os" -version = "1.10.1" -dependencies = [ - {org = "ballerina", name = "io"}, - {org = "ballerina", name = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "task" -version = "2.11.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "time"}, - {org = "ballerina", name = "uuid"} -] - -[[package]] -org = "ballerina" -name = "test" -version = "0.0.0" -scope = "testOnly" -dependencies = [ - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.array"}, - {org = "ballerina", name = "lang.error"} -] -modules = [ - {org = "ballerina", packageName = "test", moduleName = "test"} -] - -[[package]] -org = "ballerina" -name = "time" -version = "2.7.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] -modules = [ - {org = "ballerina", packageName = "time", moduleName = "time"} -] - -[[package]] -org = "ballerina" -name = "url" -version = "2.6.0" -dependencies = [ - {org = "ballerina", name = "jballerina.java"} -] - -[[package]] -org = "ballerina" -name = "uuid" -version = "1.10.0" -dependencies = [ - {org = "ballerina", name = "crypto"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "lang.int"}, - {org = "ballerina", name = "time"} -] - -[[package]] -org = "ballerina" -name = "yaml" -version = "0.8.0" -dependencies = [ - {org = "ballerina", name = "file"}, - {org = "ballerina", name = "io"}, - {org = "ballerina", name = "lang.array"}, - {org = "ballerina", name = "lang.regexp"}, - {org = "ballerina", name = "log"} -] - -[[package]] -org = "ballerinax" -name = "ai.deepseek" -version = "1.0.4" -dependencies = [ - {org = "ballerina", name = "ai"}, - {org = "ballerina", name = "http"}, - {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "test"}, - {org = "ballerina", name = "time"} -] -modules = [ - {org = "ballerinax", packageName = "ai.deepseek", moduleName = "ai.deepseek"} -] - From 04da35c38666d7fa34455962aaa32f3fcebf18e2 Mon Sep 17 00:00:00 2001 From: MohamedSabthar Date: Tue, 21 Oct 2025 17:15:56 +0530 Subject: [PATCH 5/5] Remove dead code --- ballerina/provider_utils.bal | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ballerina/provider_utils.bal b/ballerina/provider_utils.bal index 9c4a17a..ff91e2f 100644 --- a/ballerina/provider_utils.bal +++ b/ballerina/provider_utils.bal @@ -151,12 +151,6 @@ isolated function generateLlmResponse(http:Client llmClient, int maxTokens, DEEP } DeepseekTool[] tools = getGetResultsTool(responseSchema.schema); - if tools is error { - ai:Error err = error("Error in generated schema: " + tools.message()); - span.close(err); - return err; - } - DeepseekChatUserMessage[] messages = [{role: ai:USER, content}]; DeepSeekChatCompletionRequest request = { messages,