-
Notifications
You must be signed in to change notification settings - Fork 80
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
pinecone.core.exceptions.PineconeException with simple examples #154
Comments
I would double-check the environment and the API key. Any index you create will follow the URL scheme : The API keys you use must be associated with the project and environment the index belongs to. If you are confident those bits of information are correct, please let us know. We can try to debug this further. |
You are absolutely right, but part of my script is working correctly, including: index_name = "langchainjsfundamentals"
# printed ["langchainjsfundamentals"]
print(pinecone.list_indexes())
# ensure that index exists: WORKS AS I EXPECTED, print my index name
assert index_name in pinecone.list_indexes() Therefore, I believe that I provided the correct API key and index name. If we had some end-to-end functional tests to check the connection to the server, I would be able to determine the issue. However, currently, we don't have any. I have only found a few outdated and basic tests. It can be difficult to determine what the client should send and how the server should reply, which is why having integration/functional tests is crucial for developers. |
I have figured out why I possibly got that error. The host was not generated properly. Instead of Code: index = pinecone.Index(index_name)
print(index.describe_index_stats()) |
We're happy you found a solution! |
I didn't claim to have found a solution. I wondered why I got this error, but I did say that I know how it can be fixed. But now I have found a solution instead of using: pinecone.init(
api_key=os.getenv("PINECONE_API_KEY"),
environment=os.getenv("PINECONE_ENVIRONMENT")
) We should using: pinecone.init(
api_key=os.getenv("PINECONE_API_KEY"),
environment=os.getenv("PINECONE_ENVIRONMENT"),
project_name="PROJECT_ID", # SHOULD PROJECT ID!!!,
) I did not expect that all examples lies about real usage. I believe that it is a bug in library code, not in docs. So, I believe we have a bug. Please note that the JavaScript version of the library is working as expected and as described in the documentation. |
I will submit a pull request that doesn't fix the bug but helps you understand what's going on better. This will also assist other people in comprehending the issue. I will do it as soon as possible. |
@sergerdn, thanks for posting more info. We don't mention passing project id in the docs because the client is supposed to infer it from your API key and environment parameter. We make this call in (I am sure you have tried this but writing out so that others can follow it in the future) |
Yes, I confirm that I have seen it in both cases.
import logging
import os
logging.basicConfig(level=logging.DEBUG)
from dotenv import load_dotenv
load_dotenv()
import pinecone
def example_with_project_name():
pinecone.init(
api_key=os.getenv("PINECONE_API_KEY"),
environment=os.getenv("PINECONE_ENVIRONMENT"),
project_name="5d63542", # SHOULD PROJECT ID!!!
)
print(pinecone.whoami())
def example_not_with_project_name():
pinecone.init(
api_key=os.getenv("PINECONE_API_KEY"),
environment=os.getenv("PINECONE_ENVIRONMENT"),
)
print(pinecone.whoami())
if __name__ == '__main__':
example_with_project_name()
example_not_with_project_name() |
Thanks, the project_name and project_id mismatch is problematic, but we have a plan to phase it out. We have yet to do it because of some unfortunate naming mishaps(:)) in internal resources, but it'll be out soon. As for your initial connection error, the URL should be generated correctly because |
I agree with you that we don't need to change the documentation. However, I was specifically referring to the code, not the documentation. I believe that the naming convention used in the code is confusing, particularly in the case of the I understand that it happened because the API returned that name, but that's precisely why I have opened this issue. None of the examples worked as written without delving deep into the library, and there's confusion between different naming conventions as well, all because of the naming convention used. I believe that, at the very least, the comments in the library code should describe what we are getting from the API. This would make it easier for other developers to understand the naming convention used and reduce confusion. |
Noted, we'll update it. Appreciate your help 🙏 |
Using Together, they can be very helpful in testing different scenarios without making actual API requests, saving both time and resources. I believe that writing tests should be easy and very fun.😄 |
Thanks for the suggestion! Most of our tests for the client run in a separate private repo that orchestrates code generation but we'll add more tests around this |
If a user is struggling to comprehend how something functions, they may require access to tests in order to gain understanding. However, if these tests are not readily available in the main repository, the only recourse may be to explore the library with a debugger for troubleshooting. Therefore, I believe it is very important to have tests in the main repository rather than keeping them private. |
I have created a simple script from readme to demonstrate that almost simple example is not working on my end for unknown reasons. I have tested several examples with the same result. However, I tested a JavaScript version that worked perfectly on my end. But I need to work with Python.
Using
Python 3.10.10
withpoetry
on aWindows
machine. I have spent two days trying to figure out what happened, but I have had no luck.The text was updated successfully, but these errors were encountered: