This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new ebe5c0a3e4c (chores) camel-langchain4j-chat: use human-readable names 
for the tools
ebe5c0a3e4c is described below

commit ebe5c0a3e4ca44565926deea15992758c02ab872
Author: Otavio Rodolfo Piske <angusyo...@gmail.com>
AuthorDate: Wed Aug 21 17:44:08 2024 +0200

    (chores) camel-langchain4j-chat: use human-readable names for the tools
---
 .../component/langchain4j/chat/LangChain4jChatEndpoint.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/LangChain4jChatEndpoint.java
 
b/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/LangChain4jChatEndpoint.java
index e439daa7025..3585fbaa1c8 100644
--- 
a/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/LangChain4jChatEndpoint.java
+++ 
b/components/camel-ai/camel-langchain4j-chat/src/main/java/org/apache/camel/component/langchain4j/chat/LangChain4jChatEndpoint.java
@@ -34,6 +34,7 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
 import org.apache.camel.support.DefaultEndpoint;
+import org.apache.camel.util.StringHelper;
 
 import static 
org.apache.camel.component.langchain4j.chat.LangChain4jChat.SCHEME;
 
@@ -97,7 +98,15 @@ public class LangChain4jChatEndpoint extends DefaultEndpoint 
{
             throw new IllegalArgumentException(
                     "In order to use the langchain4j component as a consumer, 
you need to specify at least description, or a camelToolParameter");
         }
-        ToolSpecification toolSpecification = toolSpecificationBuilder.build();
+
+        String simpleDescription = null;
+        if (description != null) {
+            simpleDescription = 
StringHelper.dashToCamelCase(description.replace(" ", "-"));
+        }
+
+        ToolSpecification toolSpecification = toolSpecificationBuilder
+                .name(simpleDescription)
+                .build();
 
         CamelToolSpecification camelToolSpecification
                 = new CamelToolSpecification(toolSpecification, new 
LangChain4jChatConsumer(this, processor));

Reply via email to