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

[Documentation Feedback]: Quickstart guide may need few fixes #2439

Open
kavirajk opened this issue Aug 9, 2024 · 0 comments
Open

[Documentation Feedback]: Quickstart guide may need few fixes #2439

kavirajk opened this issue Aug 9, 2024 · 0 comments

Comments

@kavirajk
Copy link

kavirajk commented Aug 9, 2024

Page URL

https://weaviate.io/developers/weaviate/quickstart#client-connection-code

User feedback

Couple of feedbacks

1. Handling the wrong error variable

In the partial recap section, Below code has no value, as it is using wrong err variable from previous un-related code section.

if client.Schema().ClassCreator().WithClass(classObj).Do(context.Background()) != nil {
    panic(err)
  }

This should be something like

	if err := client.Schema().ClassCreator().WithClass(classObj).Do(context.Background()); err != nil {
		panic(err)
	}

2. Hard to know the rationale if any error in OpenAI API(s)

For example, I realized I've been using OpenAI credentials that got expired, But took me very long time to find that's the error. Reason because when we communicate ingest failure in different places (e.g: in partial re-cap section) with following code,

for _, res := range batchRes {
    if res.Result.Errors != nil {
      panic(res.Result.Errors.Error)
    }
  }

It just prints something like this on the terminal.

panic: ([]*models.ErrorResponseErrorItems0) 0x1400000ecf0

And it's not helpful.

Instead we should tell the user actual error message that is part of res.Result.Errors.Error.Message. Something like this

	for _, res := range batchRes {
		if res.Result.Errors != nil {
			msgs := make([]string, 0)
			for _, e := range res.Result.Errors.Error {
				msgs = append(msgs, e.Message)
			}
			panic(fmt.Sprintln(msgs))
		}
	}

which returns more clear message why the ingest failed.

panic: [connection to: OpenAI API failed with status: 429 error: You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant