Re: [PR] Blog post: Use Camel to integrate multiple systems with a LLM [camel-website]
Croway merged PR #1141: URL: https://github.com/apache/camel-website/pull/1141 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Blog post: Use Camel to integrate multiple systems with a LLM [camel-website]
apupier commented on PR #1141: URL: https://github.com/apache/camel-website/pull/1141#issuecomment-1952457096 > > I think that adding a video or an animated image demoing the final result would improve the wow effect and ease the understanding of the use case. BUT I let you judge if it is worthy to spend the time to do it. > > Do you know if I can load a video on camel-website? anyway, the video con be found on the example repo https://github.com/croway/camel-whatsapp-chatbot i do not know to embed a video but here it is pointing to a youtube video https://github.com/apache/camel-website/blob/6085d8f3c1904c2d56b7170abf231bdf57e73a42/content/blog/2023/12/camel-quarkus-native-vscode-debug/index.md?plain=1#L18 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Blog post: Use Camel to integrate multiple systems with a LLM [camel-website]
Croway commented on PR #1141: URL: https://github.com/apache/camel-website/pull/1141#issuecomment-1952348256 @apupier I added a demo as gif, thanks for the feedback! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Blog post: Use Camel to integrate multiple systems with a LLM [camel-website]
Croway commented on PR #1141: URL: https://github.com/apache/camel-website/pull/1141#issuecomment-1952328201 > I think that adding a video or an animated image demoing the final result would improve the wow effect and ease the understanding of the use case. BUT I let you judge if it is worthy to spend the time to do it. Do you know if I can load a video on camel-website? anyway, the video con be found on the example repo https://github.com/croway/camel-whatsapp-chatbot -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Blog post: Use Camel to integrate multiple systems with a LLM [camel-website]
apupier commented on code in PR #1141: URL: https://github.com/apache/camel-website/pull/1141#discussion_r1494361274 ## content/blog/2024/02/camel-whatsapp-langchain4j/index.md: ## @@ -0,0 +1,175 @@ +--- +title: "Integrate your AI models effortlessly with Apache Camel" +date: 2024-02-19 +draft: true Review Comment: I'm not sure on the impact of the `draft` attribute. When ready to publish I guess it needs to be turned to false -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Blog post: Use Camel to integrate multiple systems with a LLM [camel-website]
Croway commented on PR #1141: URL: https://github.com/apache/camel-website/pull/1141#issuecomment-1952165678 @apupier thanks a lot for the comments, I implemented them, and added a small section about the TypeConverters (fyi @davsclaus) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Blog post: Use Camel to integrate multiple systems with a LLM [camel-website]
apupier commented on code in PR #1141: URL: https://github.com/apache/camel-website/pull/1141#discussion_r1494129890 ## content/blog/2024/02/camel-whatsapp-langchain4j/index.md: ## @@ -0,0 +1,148 @@ +--- +title: "Integrate your AI models effortlessly with Apache Camel" +date: 2024-02-09 Review Comment: I guess you meant 2024-02-19 ## content/blog/2024/02/camel-whatsapp-langchain4j/index.md: ## @@ -0,0 +1,148 @@ +--- +title: "Integrate your AI models effortlessly with Apache Camel" +date: 2024-02-09 +draft: true +authors: [croway] +categories: ["Camel Spring Boot", "Usecases", "AI"] +preview: "Build a conversational AI integration with Apache Camel, langchain4j, and WhatsApp." +--- + + +This blog shows how Apache Camel can help integrate multiple systems with an AI model, in particular, the [camel-whatsapp](/components/4.0.x/whatsapp-component.html) component is used to build a chat on WhatsApp; so that a user can easily communicate with the LLM via WhatsApp. + + +# Overview + + +The objective is the following, I'd like to have specific conversations about some topic, in this case, how to contribute to Apache Camel, with an LLM via WhatsApp. In this context WhatsApp is just an example, Apache Camel offers 300+ components that can be easily integrated! + + +The objective is clear, but what about the implementation? Libraries like langchain4j and Apache Camel help a lot with this kind of use case, in particular, we will leverage the following features: +* camel-whatsapp will take care of the integration with WhatsApp APIs and thanks to the camel-webhook feature the communication with the WhatsApp APIs is effortless. +* On the other hand, langchain4j offers abstractions and toolkits that help developers interact with LLMs. + + +In this example, the model [GPT-3.5 Turbo](https://platform.openai.com/docs/models/gpt-3-5-turbo) is used, and the [camel core contribution documentation](/camel-core/contributing/) is used as an embedding, in this way it will be possible to have clear conversations about camel contributions. + + +# Set up + + +This is the hardest part, if you would like to test it by yourself some requirements need to be fulfilled before executing the code, in particular: + + +* A business WhatsApp account is needed, for development purposes this is free, you can follow the documentation in the [Camel WhatsApp component](/components/4.0.x/whatsapp-component.html) +* An OpenAI API key, the [langchain4j getting started](https://github.com/langchain4j#getting-started) contains information how to generate the API key +* [Webhook](https://developers.facebook.com/docs/whatsapp/cloud-api/guides/set-up-webhooks) needs to be configured in the WhatsApp business account, so that way WhatsApp API can communicate with the running Apache Camel application +* If you are testing locally, the running application's webhook has to be exposed to the internet, for example via [ngrok](https://ngrok.com/) +* Finally, the [sample application](https://github.com/Croway/camel-whatsapp-chatbot) can be cloned and run via `mvn spring-boot:run` + + +# Route Definition + + +Given a chat service that returns a String to an input String message `ConversationalAIAgent.chat(...)`, let's focus on the Camel route. + + +We would like to achieve the following: +* a user sends a message to a WhatsApp business account +* The WhatsApp API then sends the message to our running application +* The application invokes `ConversationalAIAgent.chat(...)` +* under the hood, via langchain4j abstraction, the GPT-3.5 is used to produce a response message +* The message is sent to the WhatsApp API and, finally, to the user. + + +This integration can be easily implemented by the following Camel route: + + +```java +@Autowired +ConversationalAIAgent agent; // [1] + +... + +from("webhook:whatsapp:{{camel.component.whatsapp.phone-number-id}}") // [2] + .log("${body}") + // A lot of events are received by the webhook, in this case, we want to choose only the ones that contain a message + .choice().when().jsonpath("$.entry[0].changes[0].value.messages", true) + // We will use this variable in the transformer to retrieve the recipient phone number + .setVariable("CamelWhatsappPhoneNumber", jsonpath("$.entry[0].changes[0].value.contacts[0].wa_id")) + // The body is used as input String in ConversationalAIAgent.chat(String) + .setBody(jsonpath("$.entry[0].changes[0].value.messages[0].text.body")) // [3] + // Invoke the LLM + .bean(agent) // [4] + .convertBodyTo(TextMessageRequest.class) // [5] + // reply to the number that started the conversation + .to("whatsapp:{{camel.component.whatsapp.phone-number-id}}") // [6] + .end(); +``` + + +[1] `ConversationalAIAgent` is implemented with langchain4j, it uses the camel-contributing.txt to gain information regarding the contributions rules, and GPT-3.5 to generate the response. +
Re: [PR] Blog post: Use Camel to integrate multiple systems with a LLM [camel-website]
oscerd commented on code in PR #1141: URL: https://github.com/apache/camel-website/pull/1141#discussion_r1492821341 ## content/blog/2024/02/camel-whatsapp-langchain4j/index.md: ## @@ -0,0 +1,148 @@ +--- +title: "Integrate your AI models effortlessly with Apache Camel" +date: 2024-02-09 +draft: true +authors: [croway] +categories: ["Camel Spring Boot", "Usecases", "AI"] +preview: "Build a conversational AI integration with Apache Camel, langchain4j, and WhatsApp." +--- + + +This blog shows how Apache Camel can help integrate multiple systems with an AI model, in particular, the [camel-whatsapp](https://camel.apache.org/components/4.0.x/whatsapp-component.html) component is used to build a chat on WhatsApp; so that a user can easily communicate with the LLM via WhatsApp. + + +# Overview + + +The objective is the following, I'd like to have specific conversations about some topic, in this case, how to contribute to Apache Camel, with an LLM via WhatsApp. In this context WhatsApp is just an example, Apache Camel offers 300+ components that can be easily integrated! + + +The objective is clear, but what about the implementation? Libraries like langchain4j and Apache Camel help a lot with this kind of use case, in particular, we will leverage the following features: +* camel-whatsapp will take care of the integration with WhatsApp APIs and thanks to the camel-webhook feature the communication with the WhatsApp APIs is effortless. +* On the other hand, langchain4j offers abstractions and toolkits that help developers interact with LLMs. + + +In this example, the model [GPT-3.5 Turbo](https://platform.openai.com/docs/models/gpt-3-5-turbo) is used, and the [camel core contribution documentation](https://camel.apache.org/camel-core/contributing/) is used as an embedding, in this way it will be possible to have clear conversations about camel contributions. Review Comment: For the camel link you need to use the xref syntax -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org