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

[Bug] Missing metric parameter in pinecone.createIndex #6

Open
2 tasks done
grancalavera opened this issue Oct 1, 2023 · 3 comments · May be fixed by #7
Open
2 tasks done

[Bug] Missing metric parameter in pinecone.createIndex #6

grancalavera opened this issue Oct 1, 2023 · 3 comments · May be fixed by #7
Labels
bug Something isn't working

Comments

@grancalavera
Copy link

grancalavera commented Oct 1, 2023

Is this a new bug?

  • I believe this is a new bug
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

The application throws a runtime error when trying to load the column question1 into the index semantic-search

See: src/load.ts, missing parameter metric

Expected Behavior

The application should load the column question1 into the index semantic-search

Steps To Reproduce

Follow the instructions in README.md:

  1. build the application
  2. run npm start -- load --csvPath=test.csv --column=question1

Relevant log output

PineconeUnmappedHttpError: An unexpected error occured while calling the https://controller.gcp-starter.pinecone.io/databases endpoint.  Failed to deserialize the JSON body into the target type: missing field `metric` at line 1 column 42 Status: 422.

Environment

  • OS: macOS Ventura 13.6
  • Language version: typescript
  • Pinecone client version: ^1.0.0

Additional Context

No response

@grancalavera grancalavera added the bug Something isn't working label Oct 1, 2023
@cchoi94
Copy link

cchoi94 commented Oct 24, 2023

Having this issue as well

@cchoi94
Copy link

cchoi94 commented Oct 24, 2023

After some research I checked pinecone-io/pinecone-ts-client#81

and I added the 'cosine' metric to createIndex on the load.ts page

if (indexList.indexOf({ name: indexName }) === -1) {
    await pinecone.createIndex({
      name: indexName,
      dimension: 384,
      metric: "cosine",
      waitUntilReady: true,
    });
  }

however, I'm still getting the same issue

@cchoi94
Copy link

cchoi94 commented Oct 24, 2023

@grancalavera I was able to find a way. So oddly in the docs if you don't add the metric field you should be fine because it defaults to cosine, however, for some reason thats not the case here.

So a steps

  1. Make sure your @pinecone-database/pinecone in your package.json is 1.0.0
  2. Add the the metric you want, in this case its cosine. Add this as a parameter in the createIndex function in load.ts (see above)
  3. run npm run build to update your build folder
  4. run the commands again i.e. npm start -- load --csvPath=test.csv --column=question1

Another alternative way is to create the index on the dashboard with the properties in the ui dashboard.

Tho ultimately, there still seems to be a bug where if you don't specify the metric, it doesn't default to the value?
https://github.com/pinecone-io/pinecone-ts-client/blob/22e7151c510da11528354571376c458be1e1cc92/src/control/createIndex.ts#L34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants