MuleSoft-AI-Chain-Project / mulesoft-ai-chain-connector

MuleChain AI Connector
https://mulechain.ai/docs/mulechain-ai/connector-overview
Other
11 stars 10 forks source link

Rag load document fails with file type 'url' in 0.2.0 and up #20

Closed MartijnvdB closed 1 month ago

MartijnvdB commented 1 month ago

Description

I made a Mule project for all operations except Tools in mulechain-ai-connector 0.1.0 and they all worked fine, thanks for providing this library!

Today I upgraded to version 0.2.0 and after changing the code a bit for the new response formats, the only operation that still gives problems is Rag load document with a file type of 'url'.

This operation throws the following stack trace:

Root Exception stack trace: java.lang.ClassNotFoundException: org.jsoup.nodes.Element at java.net.URLClassLoader.findClass(URLClassLoader.java:387) at org.mule.runtime.module.artifact.api.classloader.FineGrainedControlClassLoader.findLocalClass(FineGrainedControlClassLoader.java:175) at org.mule.runtime.module.artifact.api.classloader.FineGrainedControlClassLoader.loadClass(FineGrainedControlClassLoader.java:87) at org.mule.runtime.module.artifact.api.classloader.MuleArtifactClassLoader.loadClass(MuleArtifactClassLoader.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

I added a dependency for org.jsoup (that I thought might be missing somewhere) to my Mule project but that did not solve the issue.

I tried 0.2.13 and it exhibits the same issue.

How to reproduce

hc_2181

request payload: { "query": "What is today's top story?", "url": "https://nos.nl/sport"

Environment

Logging

Mule error context and stack trace attached.

mule-error.json stacktrace.txt

amirkhan-ak-sf commented 1 month ago

Hi @MartijnvdB

can you add this dependency to the application pom which you upgraded to 0.2.0.

        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.16.1</version>
        </dependency> 

Let me know if this is fixed.

Thanks, Amir

MartijnvdB commented 1 month ago

Hi Amir,

Thanks for your reply. Adding that dependency to the pom.xml of my project did not fix the issue:

image

amirkhan-ak-sf commented 1 month ago

Hi @MartijnvdB Can you try to add additionally the following to your application.pom's build tag?

Add jsoup plugin in the build tag.

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.2.0</version>
            </plugin>

            <!--  JSOUP DEPENDENCY -->
           <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-maven-plugin</artifactId>
                <version>${mule.maven.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <sharedLibraries>
                        <sharedLibrary>
                            <groupId>org.jsoup</groupId>
                            <artifactId>jsoup</artifactId>
                        </sharedLibrary>
                    </sharedLibraries>
                </configuration>
            </plugin>
        </plugins>
    </build>
MartijnvdB commented 1 month ago

Hi Amir,

That did the trick :)

Is the origin for this issue on my side? I notice that in mulechain-ai-connector's pom.xml, org.jsoup is excludede from langchain4j but it is present as a shared library for munit-extensions-maven-plugin...

Best regards,

Martijn

amirkhan-ak-sf commented 1 month ago

Thanks for the feedback Martin!

yes, it is the change we did in the architecture. Still need to document it. And no issue on your side, just the way we handle dependencies at our end to make the connector more stable.