davsclaus commented on code in PR #19261: URL: https://github.com/apache/camel/pull/19261#discussion_r2362427404
########## components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingConfiguration.java: ########## @@ -0,0 +1,161 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.docling; + +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.spi.Configurer; +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriParams; + +/** + * Configuration for the Docling component. + */ +@Configurer +@UriParams +public class DoclingConfiguration implements Cloneable { + + @UriParam + @Metadata(required = true, defaultValue = "CONVERT_TO_MARKDOWN", description = "The operation to perform") + private DoclingOperations operation = DoclingOperations.CONVERT_TO_MARKDOWN; + + @UriParam(label = "advanced") + @Metadata(description = "Path to Docling Python executable or command") + private String doclingCommand = "docling"; + + @UriParam(label = "advanced") + @Metadata(description = "Working directory for Docling execution") + private String workingDirectory; + + @UriParam + @Metadata(description = "Enable OCR processing for scanned documents", defaultValue = "true") + private boolean enableOCR = true; + + @UriParam + @Metadata(description = "Language code for OCR processing", defaultValue = "en") + private String ocrLanguage = "en"; + + @UriParam + @Metadata(description = "Output format for document conversion", defaultValue = "markdown") + private String outputFormat = "markdown"; Review Comment: If we know which output formats only are possible then you can use enums="aaa,bbb,ccc" to list them ########## components/camel-ai/camel-docling/src/main/docs/docling-component.adoc: ########## @@ -0,0 +1,216 @@ += Docling Component +:doctitle: Docling +:shortname: docling +:artifactid: camel-docling +:description: Process documents using Docling library for parsing and conversion. +:since: 4.15 +:supportlevel: Preview +:tabs-sync-option: +:component-header: Both producer and consumer are supported +//Manually maintained attributes +:group: AI +:camel-spring-boot-name: docling + +*Since Camel {since}* + +*{component-header}* + +The Docling component allows you to convert and process documents using https://github.com/DS4SD/docling[IBM's Docling AI document parser]. +Docling is a powerful Python library that can parse and convert various document formats including PDF, Word documents, PowerPoint presentations, and more into structured formats like Markdown, HTML, JSON, or plain text. + +Maven users will need to add the following dependency to their `pom.xml` for this component: + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-docling</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +---- + +== Prerequisites + +Before using this component, you need to have Docling installed on your system. You can install it using pip: + +[source,bash] Review Comment: I wonder if we can make a test-infra module for this, where there is some pre existing docker image that comes with this docling installed and that we can make this possible to be used - though it can be researcher in another PR / work ########## components/camel-ai/camel-docling/src/main/java/org/apache/camel/component/docling/DoclingEndpoint.java: ########## @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.docling; + +import org.apache.camel.Category; +import org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.spi.Metadata; +import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; +import org.apache.camel.spi.UriPath; +import org.apache.camel.support.DefaultEndpoint; + +/** + * Process documents using Docling library for parsing and conversion. + */ +@UriEndpoint(firstVersion = "4.15.0", scheme = "docling", Review Comment: consumerOnly = true -- 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]
