millions-furniture-75402
03/25/2024, 1:00 PMmillions-furniture-75402
03/25/2024, 1:19 PMimport os
from dotenv import load_dotenv
from pinecone import Pinecone, PodSpec # pylint: disable=import-error
load_dotenv()
pc = Pinecone(api_key=os.environ.get("PINECONE_API_KEY"))
pc.create_index(
name="my-index", dimension=1536, metric="cosine", spec=PodSpec(environment="us-west-1-gcp", pod_type="p1.x1", pods=1)
)
But many iterations of this, an I'm getting 404s:
import pinecone_pulumi as pinecone
# Create a Pinecone Index with a "starter" pod configuration
pinecone_index = pinecone.PineconeIndex("my-index",
name="my-index",
spec=pinecone.PineconeSpecArgs(
pod=pinecone.PineconePodSpecArgs(
pods=1,
shards=1,
pod_type="p1.x1",
replicas=1,
environment=pinecone.ServerlessSpecCloud.GCP,
)
),
metric="cosine",
dimension=1536,
)
many-telephone-49025
03/25/2024, 1:54 PMpulumi up -d
many-telephone-49025
03/25/2024, 1:54 PMmillions-furniture-75402
03/25/2024, 2:06 PMdebug: Pinecone index creation response: {"error": {"code":"NOT_FOUND","message":"Resource gcp not found"},"status":404}
many-telephone-49025
03/25/2024, 2:08 PMenvironment=pinecone.ServerlessSpecCloud.GCP,
with a pod based indexmillions-furniture-75402
03/25/2024, 2:17 PMmany-telephone-49025
03/25/2024, 2:36 PMmany-telephone-49025
03/25/2024, 2:41 PMPinecone index creation response: …
is important for memillions-furniture-75402
03/25/2024, 3:45 PMpinecone-client
directly
The region should be us-central1-gcp
but I can't overcome this issue: "Increase you quota or upgrade to create more indexes."
If I list indexes (via library or web application), I don't see any. I've tried deleting and recreating the project.many-telephone-49025
03/25/2024, 3:46 PMmillions-furniture-75402
03/25/2024, 3:46 PMmany-telephone-49025
03/25/2024, 3:46 PMmany-telephone-49025
03/25/2024, 3:46 PMmillions-furniture-75402
03/25/2024, 3:46 PMmany-telephone-49025
03/25/2024, 3:47 PMmillions-furniture-75402
03/25/2024, 3:47 PMmany-telephone-49025
03/25/2024, 3:47 PMmillions-furniture-75402
03/25/2024, 3:47 PMmany-telephone-49025
03/25/2024, 3:47 PMmany-telephone-49025
03/25/2024, 3:48 PMmillions-furniture-75402
03/25/2024, 3:48 PMmillions-furniture-75402
03/25/2024, 3:49 PMmany-telephone-49025
03/25/2024, 3:49 PMmillions-furniture-75402
03/25/2024, 3:50 PMmillions-furniture-75402
03/25/2024, 3:50 PMmany-telephone-49025
03/25/2024, 3:50 PMmillions-furniture-75402
03/25/2024, 3:56 PMpod_type
needs to be starter
and environment
needs to gcp-starter
This isn't even documented in Pinecone docs, let alone the Pulumi provider. I was able to infer this by manually creating one in the console. A real missed opportunity for Pinecone.millions-furniture-75402
03/25/2024, 3:57 PMmany-telephone-49025
03/25/2024, 3:57 PMmillions-furniture-75402
03/25/2024, 3:58 PMValueError: '' is not a valid ServerlessSpecCloud
seems to be the issue
I can put together an issue for their GitHub repository later this week.many-telephone-49025
03/25/2024, 3:58 PMmany-telephone-49025
03/25/2024, 3:59 PMmillions-furniture-75402
03/25/2024, 3:59 PMmany-telephone-49025
03/25/2024, 3:59 PMmany-telephone-49025
03/25/2024, 4:00 PMmillions-furniture-75402
03/25/2024, 4:04 PMpod=1
, which ultimately led to the issue. Here's the final "this works with the free tier" example.
pinecone_index = pinecone.PineconeIndex(
"my-index",
name="my-index",
spec=pinecone.PineconeSpecArgs(
pod=pinecone.PineconePodSpecArgs(
environment="gcp-starter",
pod_type="starter",
replicas=1,
)
),
metric="cosine",
dimension=1536,
)
millions-furniture-75402
03/25/2024, 4:06 PMmany-telephone-49025
03/25/2024, 4:06 PMmany-telephone-49025
03/25/2024, 4:07 PMmillions-furniture-75402
03/25/2024, 4:07 PMmany-telephone-49025
03/25/2024, 4:08 PMmany-telephone-49025
03/25/2024, 4:09 PMmany-telephone-49025
03/25/2024, 5:50 PMmany-telephone-49025
03/25/2024, 5:51 PMconst myPineconeIndex = new pinecone.PineconeIndex("myPineconeIndex", {
name: "example-index",
metric: pinecone.IndexMetric.Cosine,
spec: {
pod: {
podType: "starter",
replicas: 1,
pods: 1,
environment: "gcp-starter",
}
},
});
export const output = {
value: myPineconeIndex.host,
};
millions-furniture-75402
03/25/2024, 5:52 PMmany-telephone-49025
03/25/2024, 5:52 PMmany-telephone-49025
03/25/2024, 6:23 PMmany-telephone-49025
03/25/2024, 6:24 PMmany-telephone-49025
03/25/2024, 7:31 PMerror: failed to create Pinecone index: example-index3 with error: Projects only support a single Starter index.
This happens, when you edit an existing resource which has to be replaced to make the change (like remove pod property)
You can use https://www.pulumi.com/docs/concepts/options/deletebeforereplace/ to have the index deleted before recreation!
new version is 0.4.1
millions-furniture-75402
03/25/2024, 7:33 PMmany-telephone-49025
03/25/2024, 7:37 PMmillions-furniture-75402
03/25/2024, 7:52 PMValueError '' is not a valid ServerlessSpecCloud
. It might have to do with the remarshaling of outputs. I tried recreating my venv, and have the same failure. Looking at the enums in the library now.many-telephone-49025
03/25/2024, 7:53 PMmany-telephone-49025
03/25/2024, 7:53 PMmany-telephone-49025
03/25/2024, 7:54 PMmany-telephone-49025
03/25/2024, 7:54 PMmillions-furniture-75402
03/25/2024, 7:54 PMmillions-furniture-75402
03/25/2024, 7:58 PMmany-telephone-49025
03/25/2024, 9:25 PMmany-telephone-49025
03/25/2024, 9:25 PMmany-telephone-49025
03/25/2024, 10:20 PMmany-telephone-49025
03/27/2024, 11:31 PMv0.4.2