Database
- Indexes
- Vectors
- Search
- Imports
- Backups
Inference
- Embed
- Rerank
Assistant
- Assistants
- Files
- Chat
- Evaluation
- Context snippets
Vectors
Upsert text
Upsert source text into a namespace. Pinecone converts the text to vectors automatically using the hosted embedding model associated with the index.
Upserting text is supported only for indexes with integrated embedding.
For guidance and examples, see Upsert data.
POST
/
records
/
namespaces
/
{namespace}
/
upsert
# pip install --upgrade pinecone
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
index = pc.Index("example-index")
index.upsert_records(
"example-namespace",
[
{
"_id": "rec1",
"chunk_text": "Apple's first product, the Apple I, was released in 1976 and was hand-built by co-founder Steve Wozniak.",
"category": "product",
},
{
"_id": "rec2",
"chunk_text": "Apples are a great source of dietary fiber, which supports digestion and helps maintain a healthy gut.",
"category": "nutrition",
},
{
"_id": "rec3",
"chunk_text": "Apples originated in Central Asia and have been cultivated for thousands of years, with over 7,500 varieties available today.",
"category": "cultivation",
},
{
"_id": "rec4",
"chunk_text": "In 2001, Apple released the iPod, which transformed the music industry by making portable music widely accessible.",
"category": "product",
},
{
"_id": "rec5",
"chunk_text": "Apple went public in 1980, making history with one of the largest IPOs at that time.",
"category": "milestone",
},
{
"_id": "rec6",
"chunk_text": "Rich in vitamin C and other antioxidants, apples contribute to immune health and may reduce the risk of chronic diseases.",
"category": "nutrition",
},
{
"_id": "rec7",
"chunk_text": "Known for its design-forward products, Apple's branding and market strategy have greatly influenced the technology sector and popularized minimalist design worldwide.",
"category": "influence",
},
{
"_id": "rec8",
"chunk_text": "The high fiber content in apples can also help regulate blood sugar levels, making them a favorable snack for people with diabetes.",
"category": "nutrition",
},
],
)
# pip install --upgrade pinecone
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
index = pc.Index("example-index")
index.upsert_records(
"example-namespace",
[
{
"_id": "rec1",
"chunk_text": "Apple's first product, the Apple I, was released in 1976 and was hand-built by co-founder Steve Wozniak.",
"category": "product",
},
{
"_id": "rec2",
"chunk_text": "Apples are a great source of dietary fiber, which supports digestion and helps maintain a healthy gut.",
"category": "nutrition",
},
{
"_id": "rec3",
"chunk_text": "Apples originated in Central Asia and have been cultivated for thousands of years, with over 7,500 varieties available today.",
"category": "cultivation",
},
{
"_id": "rec4",
"chunk_text": "In 2001, Apple released the iPod, which transformed the music industry by making portable music widely accessible.",
"category": "product",
},
{
"_id": "rec5",
"chunk_text": "Apple went public in 1980, making history with one of the largest IPOs at that time.",
"category": "milestone",
},
{
"_id": "rec6",
"chunk_text": "Rich in vitamin C and other antioxidants, apples contribute to immune health and may reduce the risk of chronic diseases.",
"category": "nutrition",
},
{
"_id": "rec7",
"chunk_text": "Known for its design-forward products, Apple's branding and market strategy have greatly influenced the technology sector and popularized minimalist design worldwide.",
"category": "influence",
},
{
"_id": "rec8",
"chunk_text": "The high fiber content in apples can also help regulate blood sugar levels, making them a favorable snack for people with diabetes.",
"category": "nutrition",
},
],
)
Authorizations
Path Parameters
The namespace to upsert records into.
Body
application/x-ndjson · object[]
The unique ID of the record to upsert. Note that id
can be used as an alias for _id
.
Was this page helpful?
# pip install --upgrade pinecone
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
index = pc.Index("example-index")
index.upsert_records(
"example-namespace",
[
{
"_id": "rec1",
"chunk_text": "Apple's first product, the Apple I, was released in 1976 and was hand-built by co-founder Steve Wozniak.",
"category": "product",
},
{
"_id": "rec2",
"chunk_text": "Apples are a great source of dietary fiber, which supports digestion and helps maintain a healthy gut.",
"category": "nutrition",
},
{
"_id": "rec3",
"chunk_text": "Apples originated in Central Asia and have been cultivated for thousands of years, with over 7,500 varieties available today.",
"category": "cultivation",
},
{
"_id": "rec4",
"chunk_text": "In 2001, Apple released the iPod, which transformed the music industry by making portable music widely accessible.",
"category": "product",
},
{
"_id": "rec5",
"chunk_text": "Apple went public in 1980, making history with one of the largest IPOs at that time.",
"category": "milestone",
},
{
"_id": "rec6",
"chunk_text": "Rich in vitamin C and other antioxidants, apples contribute to immune health and may reduce the risk of chronic diseases.",
"category": "nutrition",
},
{
"_id": "rec7",
"chunk_text": "Known for its design-forward products, Apple's branding and market strategy have greatly influenced the technology sector and popularized minimalist design worldwide.",
"category": "influence",
},
{
"_id": "rec8",
"chunk_text": "The high fiber content in apples can also help regulate blood sugar levels, making them a favorable snack for people with diabetes.",
"category": "nutrition",
},
],
)