Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error messaging with vectordb procedures #4109

Open
vga91 opened this issue Jun 25, 2024 · 1 comment
Open

Better error messaging with vectordb procedures #4109

vga91 opened this issue Jun 25, 2024 · 1 comment

Comments

@vga91
Copy link
Contributor

vga91 commented Jun 25, 2024

The following procedure should return the root cause (i.e. the collection already exists):

Bildschirmfoto 2024-06-21 um 15 05 03 (1)

Procedure errors to handle and improve:

  • apoc.vectordb..createCollection with existing collection
  • apoc.vectordb..deleteCollection with non existing collection
  • apoc.vectordb..get/upsert/delete with wrong format id
  • apoc.vectordb..upsert/query with wrong embedding size
@vga91 vga91 moved this to Todo in APOC Extended Larus Jun 25, 2024
@vga91 vga91 changed the title Better error messaging in vectordb procedures Better error messaging with apoc.vectordb.weaviate.createCollection procedure Jun 28, 2024
@vga91
Copy link
Contributor Author

vga91 commented Jul 1, 2024

Currently, it does not seem possible to solve the issue by acting on APOC Extended, it would be necessary to modify APOC Core.

The following solution (i.e. the one provided in the internal APOC core Trello with id G2oExgfb) would solve the issue:

// placed in StreamCollection.UrlStreamConnection class by replacing the present method

        @Override
        public InputStream getInputStream() throws IOException {
            if (con instanceof HttpURLConnection httpConn && httpConn.getResponseCode() >= 400)
            {
                // return ErrorStream as a RuntimeException
                String errMsg = new String(httpConn.getErrorStream().readAllBytes());
                throw new RuntimeException("Error during HTTP call:\n" + errMsg);
            }

            return toLimitedIStream(con.getInputStream(), getLength());
        }

By returning the following output in case of an existing collection:

org.neo4j.graphdb.QueryExecutionException:
Failed to invoke procedure `apoc.vectordb.weaviate.createCollection`: Caused by: java.lang.RuntimeException: Error during HTTP call:
{"error":[{"message":"class name \"TestCollection\" already exists"}]}

Examples of test case to update after the above fixes: 99e6025

@vga91 vga91 moved this from Todo to Blocked in APOC Extended Larus Jul 1, 2024
@vga91 vga91 changed the title Better error messaging with apoc.vectordb.weaviate.createCollection procedure Better error messaging with vectordb procedures Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Blocked
Development

No branches or pull requests

1 participant