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

What mean of "Not Found" #4096

Closed
meithon opened this issue Jan 20, 2024 · 3 comments
Closed

What mean of "Not Found" #4096

meithon opened this issue Jan 20, 2024 · 3 comments
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@meithon
Copy link

meithon commented Jan 20, 2024

I executed this code.

/* eslint-disable @typescript-eslint/no-explicit-any */
import weaviate from "weaviate-ts-client";
import { WeaviateStore } from "@langchain/community/vectorstores/weaviate";
import { OpenAIEmbeddings } from "@langchain/openai";

export async function run() {
  // Something wrong with the weaviate-ts-client types, so we need to disable
  const client = weaviate.client({
    scheme: process.env.WEAVIATE_SCHEME || "http",
    host: process.env.WEAVIATE_HOST || "localhost:8080",
  });
  const docs = [{ pageContent: "see ya!", metadata: { foo: "bar" } }];

  WeaviateStore.fromDocuments(docs, new OpenAIEmbeddings(), {
    client,
    indexName: "Test",
  });
}

run();

Returned this error

150 |             if (errorMessages.length > 0) {
151 |                 throw new Error(errorMessages.join("\n"));
152 |             }
153 |         }
154 |         catch (e) {
155 |             throw Error(`Error adding vectors: ${e}`);
                        ^
error: Error adding vectors: Error: usage error (404): {"detail":"Not Found"}
      at /Users/mei/workspace/private/langchain-ts/node_modules/@langchain/community/dist/vectorstores/weaviate.js:155:19

What was not found for this?
And how can this be resolved?

Copy link

dosubot bot commented Jan 20, 2024

🤖

Hello @rneithon! Nice to see you back here. I hope your project is coming along well. Let's take a look at this issue you've encountered.

The "Not Found" error you're encountering is likely due to the Weaviate instance not being able to find the resource you're trying to access. This could be due to a number of reasons, such as the Weaviate instance not being properly set up, the specified index not existing, or the Weaviate instance not being reachable at the specified host and port.

In your code, you're trying to create a Weaviate client and use it to add documents to a Weaviate store. The error is thrown when the WeaviateStore.fromDocuments function is called. This function tries to add the provided documents to the Weaviate index specified in the indexName argument. If this index does not exist in the Weaviate instance, or if the Weaviate instance is not reachable, a "Not Found" error could be thrown.

Here's how you can troubleshoot this issue:

  1. Check the Weaviate instance: Make sure that the Weaviate instance is properly set up and running. You can do this by trying to access the Weaviate instance directly using its host and port. If you're running Weaviate locally, you can try accessing http://localhost:8080 in your browser.

  2. Check the index: Make sure that the index you're trying to add documents to exists in the Weaviate instance. You can do this by checking the Weaviate instance's schema. If the index does not exist, you'll need to create it before you can add documents to it.

  3. Check the host and port: Make sure that the host and port you're using to create the Weaviate client match the host and port of the Weaviate instance. In your code, you're using the WEAVIATE_HOST environment variable to specify the host and port. Make sure that this environment variable is correctly set to the host and port of the Weaviate instance.

If you've checked all of these and you're still encountering the error, it would be helpful if you could provide more information about your setup. Specifically, it would be helpful to know how your Weaviate instance is set up, what the WEAVIATE_HOST environment variable is set to, and whether the index you're trying to add documents to exists in the Weaviate instance.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label Jan 20, 2024
@meithon
Copy link
Author

meithon commented Jan 20, 2024

I use this docker-compose.yml

version: "3.4"
services:
  weaviate:
    command:
      - --host
      - 0.0.0.0
      - --port
      - "8080"
      - --scheme
      - http
    image: semitechnologies/weaviate:1.23.3
    env_file: .env
    ports:
      - 8080:8080
      - 50051:50051
    volumes:
      - weaviate_data:/var/lib/weaviate
    restart: on-failure:0
    environment:
      QNA_INFERENCE_API: "http://qna-transformers:8080"
      NER_INFERENCE_API: "http://ner-transformers:8080"
      SPELLCHECK_INFERENCE_API: "http://text-spellcheck:8080"
      OPENAI_APIKEY: $OPENAI_API_KEY
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: "true"
      PERSISTENCE_DATA_PATH: "/var/lib/weaviate"
      DEFAULT_VECTORIZER_MODULE: "text2vec-openai"
      ENABLE_MODULES: "text2vec-openai,qna-transformers,ner-transformers,text-spellcheck,ref2vec-centroid,generative-openai"
      CLUSTER_HOSTNAME: "node1"
  qna-transformers:
    image: semitechnologies/qna-transformers:distilbert-base-uncased-distilled-squad
    environment:
      ENABLE_CUDA: "0"
  ner-transformers:
    image: semitechnologies/ner-transformers:dbmdz-bert-large-cased-finetuned-conll03-english
    environment:
      ENABLE_CUDA: "0"
  text-spellcheck:
    image: semitechnologies/text-spellcheck-model:pyspellchecker-en
volumes:
  weaviate_data:

@kahirokunn
Copy link

@rneithon awesome

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Jul 10, 2024
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2024
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants