Skip to content

Commit 4595a1e

Browse files
restructure recommendations for index targeting in md guides, npm run format, fix VERCEL_TOKEN not being threaded through from to the release -> pr flow properly
1 parent cabd7a6 commit 4595a1e

File tree

15 files changed

+194
-83
lines changed

15 files changed

+194
-83
lines changed

.github/workflows/pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ on:
1515
secrets:
1616
PINECONE_API_KEY:
1717
required: true
18+
VERCEL_TOKEN:
19+
required: true
1820

1921
permissions:
2022
contents: read

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
7777
// const pc = new Pinecone();
7878

7979
// 2. Create a serverless index
80-
await pc.createIndex({
80+
const indexModel = await pc.createIndex({
8181
name: 'example-index',
8282
dimension: 1536,
8383
metric: 'cosine',
@@ -90,7 +90,7 @@ await pc.createIndex({
9090
});
9191

9292
// 3. Target the index
93-
const index = pc.index({ name: 'example-index' });
93+
const index = pc.index({ host: indexModel.host });
9494

9595
// 4. Upsert vectors with metadata
9696
await index.upsert({
@@ -193,7 +193,7 @@ console.log(searchResponse);
193193

194194
## Pinecone Assistant
195195

196-
The [Pinecone Assistant API](https://docs.pinecone.io/guides/assistant/understanding-assistant) enables you to create and manage AI assistants powered by Pinecone's vector database capabilities. These Assistants can be customized with specific instructions and metadata, and can interact with files and engage in chat conversations.
196+
The [Pinecone Assistant API](https://docs.pinecone.io/guides/assistant) enables you to create and manage AI assistants powered by Pinecone's vector database capabilities. These Assistants can be customized with specific instructions and metadata, and can interact with files and engage in chat conversations.
197197

198198
```typescript
199199
import { Pinecone } from '@pinecone-database/pinecone';

guides/data-operations/bulk-import.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Bulk Import
22

3-
You can [import vectors en masse](https://docs.pinecone.io/guides/index-data/import-data) from object storage. `Import` is a long-running, asynchronous operation that imports large numbers of records into a Pinecone serverless index.
3+
You can [import vectors in bulk](https://docs.pinecone.io/guides/index-data/import-data) from object storage. `Import` is a long-running, asynchronous operation that imports large numbers of records into a Pinecone serverless index.
44

55
> **Note:**
66
>
@@ -24,7 +24,7 @@ const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
2424
const indexName = 'sample-index';
2525

2626
// Ensure you have a serverless index
27-
await pc.createIndex({
27+
const indexModel = await pc.createIndex({
2828
name: indexName,
2929
dimension: 10,
3030
spec: {
@@ -35,7 +35,8 @@ await pc.createIndex({
3535
},
3636
});
3737

38-
const index = pc.index({ name: indexName });
38+
// Get the host from the create response
39+
const index = pc.index({ host: indexModel.host });
3940

4041
const storageURI = 's3://my-bucket/my-directory/';
4142

@@ -58,7 +59,9 @@ You can check the status of an import operation using `describeImport`:
5859
import { Pinecone } from '@pinecone-database/pinecone';
5960

6061
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
61-
const index = pc.index({ name: 'sample-index' });
62+
63+
const indexModel = await pc.describeIndex('sample-index');
64+
const index = pc.index({ host: indexModel.host });
6265

6366
const importStatus = await index.describeImport('import-id');
6467
console.log(importStatus);
@@ -81,7 +84,9 @@ You can list all import operations for an index:
8184
import { Pinecone } from '@pinecone-database/pinecone';
8285

8386
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
84-
const index = pc.index({ name: 'sample-index' });
87+
88+
const indexModel = await pc.describeIndex('sample-index');
89+
const index = pc.index({ host: indexModel.host });
8590

8691
const imports = await index.listImports();
8792
console.log(imports);
@@ -124,7 +129,9 @@ You can cancel an ongoing import operation:
124129
import { Pinecone } from '@pinecone-database/pinecone';
125130

126131
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
127-
const index = pc.index({ name: 'sample-index' });
132+
133+
const indexModel = await pc.describeIndex('sample-index');
134+
const index = pc.index({ host: indexModel.host });
128135

129136
await index.cancelImport('import-id');
130137
```
@@ -139,7 +146,9 @@ When starting an import, you can specify how errors should be handled:
139146
import { Pinecone } from '@pinecone-database/pinecone';
140147

141148
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
142-
const index = pc.index({ name: 'sample-index' });
149+
150+
const indexModel = await pc.describeIndex('sample-index');
151+
const index = pc.index({ host: indexModel.host });
143152

144153
// Continue on errors
145154
await index.startImport({
@@ -162,7 +171,9 @@ Here's a complete example of monitoring an import until completion:
162171
import { Pinecone } from '@pinecone-database/pinecone';
163172

164173
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
165-
const index = pc.index({ name: 'sample-index' });
174+
175+
const indexModel = await pc.describeIndex('sample-index');
176+
const index = pc.index({ host: indexModel.host });
166177

167178
// Start the import
168179
const { id } = await index.startImport({

guides/data-operations/metadata-filtering.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ Pinecone supports the following filter operators:
2525
import { Pinecone } from '@pinecone-database/pinecone';
2626

2727
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
28-
const index = pc.index({ name: 'my-index' });
28+
29+
const indexModel = await pc.describeIndex('my-index');
30+
const index = pc.index({ host: indexModel.host });
2931

3032
const results = await index.query({
3133
vector: [0.1, 0.2, 0.3, 0.4],
@@ -42,7 +44,9 @@ const results = await index.query({
4244
import { Pinecone } from '@pinecone-database/pinecone';
4345

4446
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
45-
const index = pc.index({ name: 'my-index' });
47+
48+
const indexModel = await pc.describeIndex('my-index');
49+
const index = pc.index({ host: indexModel.host });
4650

4751
const results = await index.query({
4852
vector: [0.1, 0.2, 0.3, 0.4],
@@ -59,7 +63,9 @@ const results = await index.query({
5963
import { Pinecone } from '@pinecone-database/pinecone';
6064

6165
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
62-
const index = pc.index({ name: 'my-index' });
66+
67+
const indexModel = await pc.describeIndex('my-index');
68+
const index = pc.index({ host: indexModel.host });
6369

6470
const results = await index.query({
6571
vector: [0.1, 0.2, 0.3, 0.4],
@@ -80,7 +86,9 @@ By default, multiple filter conditions are combined with AND:
8086
import { Pinecone } from '@pinecone-database/pinecone';
8187

8288
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
83-
const index = pc.index({ name: 'my-index' });
89+
90+
const indexModel = await pc.describeIndex('my-index');
91+
const index = pc.index({ host: indexModel.host });
8492

8593
const results = await index.query({
8694
vector: [0.1, 0.2, 0.3, 0.4],
@@ -117,7 +125,9 @@ Use `$or` to match vectors that satisfy any of multiple conditions:
117125
import { Pinecone } from '@pinecone-database/pinecone';
118126

119127
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
120-
const index = pc.index({ name: 'my-index' });
128+
129+
const indexModel = await pc.describeIndex('my-index');
130+
const index = pc.index({ host: indexModel.host });
121131

122132
const results = await index.query({
123133
vector: [0.1, 0.2, 0.3, 0.4],
@@ -142,7 +152,9 @@ You can nest `$and` and `$or` operators to create complex filters:
142152
import { Pinecone } from '@pinecone-database/pinecone';
143153

144154
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
145-
const index = pc.index({ name: 'my-index' });
155+
156+
const indexModel = await pc.describeIndex('my-index');
157+
const index = pc.index({ host: indexModel.host });
146158

147159
const results = await index.query({
148160
vector: [0.1, 0.2, 0.3, 0.4],
@@ -167,7 +179,9 @@ Combine different field types and operators:
167179
import { Pinecone } from '@pinecone-database/pinecone';
168180

169181
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
170-
const index = pc.index({ name: 'my-index' });
182+
183+
const indexModel = await pc.describeIndex('my-index');
184+
const index = pc.index({ host: indexModel.host });
171185

172186
const results = await index.query({
173187
vector: [0.1, 0.2, 0.3, 0.4],
@@ -190,6 +204,8 @@ import { Pinecone } from '@pinecone-database/pinecone';
190204

191205
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
192206

207+
const indexModel = await pc.describeIndex('my-index');
208+
193209
type MovieMetadata = {
194210
genre: 'comedy' | 'horror' | 'drama' | 'action';
195211
year: number;

guides/data-operations/namespaces.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,33 @@
22

33
Namespaces allow you to partition vectors within an index. This is useful for organizing different types of data, implementing multitenancy, or isolating test data from production data.
44

5-
For more information, see [Use namespaces](https://docs.pinecone.io/guides/manage-data/manage-namespaces).
5+
For more information, see [Manage namespaces](https://docs.pinecone.io/guides/manage-data/manage-namespaces).
66

77
## Working with namespaces
88

9-
By default, all data operations take place inside the default namespace of `''`. If you are working with other non-default namespaces, you can specify the namespace when targeting an index:
9+
By default, all data operations take place inside the default namespace of `'__default__'`. If you are working with other non-default namespaces, you can specify the namespace when targeting an index:
1010

1111
```typescript
1212
import { Pinecone } from '@pinecone-database/pinecone';
1313

1414
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
15-
const index = pc.index({ name: 'test-index', namespace: 'ns1' });
15+
16+
const indexModel = await pc.describeIndex('test-index');
17+
const index = pc.index({ host: indexModel.host, namespace: 'ns1' });
1618

1719
// Now all operations will use the 'ns1' namespace
1820
await index.fetch({ ids: ['1'] });
1921
```
2022

21-
Alternatively, you can specify the namespace for individual operations:
23+
Alternatively, you can specify the namespace for individual operations. Note that this will override any namespace set on the `Index` class:
2224

2325
```typescript
2426
import { Pinecone } from '@pinecone-database/pinecone';
2527

2628
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
27-
const index = pc.index({ name: 'test-index' });
29+
30+
const indexModel = await pc.describeIndex('test-index');
31+
const index = pc.index({ host: indexModel.host });
2832

2933
// Query in a specific namespace
3034
await index.query({
@@ -42,7 +46,9 @@ The following example lists all namespaces in an index:
4246
import { Pinecone } from '@pinecone-database/pinecone';
4347

4448
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
45-
const index = pc.index({ name: 'test-index' });
49+
50+
const indexModel = await pc.describeIndex('test-index');
51+
const index = pc.index({ host: indexModel.host });
4652

4753
const namespaces = await index.listNamespaces();
4854
console.log(namespaces);
@@ -59,7 +65,9 @@ The following example describes a specific namespace:
5965
import { Pinecone } from '@pinecone-database/pinecone';
6066

6167
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
62-
const index = pc.index({ name: 'test-index' });
68+
69+
const indexModel = await pc.describeIndex('test-index');
70+
const index = pc.index({ host: indexModel.host });
6371

6472
const namespace = await index.describeNamespace('ns1');
6573
console.log(namespace);
@@ -77,7 +85,9 @@ The following example deletes a namespace and all its vectors:
7785
import { Pinecone } from '@pinecone-database/pinecone';
7886

7987
const pc = new Pinecone({ apiKey: 'YOUR_API_KEY' });
80-
const index = pc.index({ name: 'test-index' });
88+
89+
const indexModel = await pc.describeIndex('test-index');
90+
const index = pc.index({ host: indexModel.host });
8191

8292
await index.deleteNamespace('ns1');
8393
```
@@ -86,10 +96,9 @@ await index.deleteNamespace('ns1');
8696
8797
## Namespace best practices
8898

89-
1. **Multitenancy**: Use namespaces to isolate data for different customers or tenants
99+
1. **Multitenancy**: Use namespaces to isolate data for different purposes
90100
2. **Environment separation**: Keep dev, staging, and production data separate
91101
3. **Data organization**: Group related vectors together (e.g., by document, user, or time period)
92102
4. **Prefix naming**: Consider using ID prefixes in combination with namespaces for hierarchical organization
93-
5. **Query performance**: Querying within a namespace is faster than querying across the entire index
94103

95104
For more information on implementing multitenancy, see [Implement multitenancy](https://docs.pinecone.io/guides/index-data/implement-multitenancy).

0 commit comments

Comments
 (0)