atiaomar1978-hub commented on code in PR #25893:
URL: https://github.com/apache/camel/pull/25893#discussion_r3890034243


##########
components/camel-ai/camel-langchain4j-chat/src/main/docs/langchain4j-chat-component.adoc:
##########
@@ -367,6 +367,35 @@ from("direct:chat")
     .to("langchain4j-chat:my-chat");
 ----
 
+=== Structured error exchange properties
+
+When a LangChain4j chat call fails, Camel sets structured metadata on the 
exchange **before** the model exception propagates. This works even when GenAI 
observability is disabled.
+
+[cols="2,3"]
+|===
+| Exchange property | Meaning
+
+| `CamelAiErrorCategory` | Coarse category derived from the LangChain4j 
exception: `RATE_LIMIT`, `SERVER_ERROR`, `VALIDATION`, `AUTH`, or `UNKNOWN`
+| `CamelAiRetryAfterMillis` | Not populated for LangChain4j providers 
(OpenAI-only today)
+|===
+
+Category-based handling complements matching on `RetriableException` / 
`NonRetriableException` above:
+
+[source, java]
+----
+onException(Exception.class)
+    .process(exchange -> {
+        String category = exchange.getProperty("CamelAiErrorCategory", 
String.class);
+        if ("VALIDATION".equals(category)) {
+            exchange.getIn().setHeader("Rejected", true);
+        }
+    })
+    .handled(true)
+    .to("direct:rejected");
+----
+
+The same properties are set by 
xref:langchain4j-agent-component.adoc[LangChain4j Agent] and 
xref:langchain4j-embeddings-component.adoc[LangChain4j Embeddings] on their 
failure paths. See 
xref:ai-llm-integration-guide.adoc#_structured_error_exchange_properties[AI LLM 
integration guide] for a cross-component overview.

Review Comment:
   Done — added *Structured error exchange properties* sections to 
`langchain4j-agent-component.adoc`, `langchain4j-embeddings-component.adoc`, 
and `spring-ai-chat-component.adoc`, and updated the cross-links in 
`ai-llm-integration-guide.adoc`. Regenerated the catalog doc mirrors in 
`817a50e9dd3`.
   
   _AI-generated on behalf of atiaomar1978-hub (Cursor Cloud Agent)_



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to