管理索引

使用 Pinecone 构建 AI 应用

James Chapman

Curriculum Manager, DataCamp

连接索引

pc = Pinecone(api_key="API_KEY")

pc.create_index(
    name='datacamp-index',
    dimension=1536,
    spec=ServerlessSpec(
        cloud='aws', 
        region='us-east-1'
    )
)


index = pc.Index('datacamp-index')
使用 Pinecone 构建 AI 应用

连接索引

index = pc.Index('datacamp-first')
...
pinecone.core.client.exceptions.NotFoundException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'content-type': 'text/plain; charset=...
HTTP response body: {"error":{"code":"NOT_FOUND","message":"Resource datacamp-first
not found"},"status":404}
使用 Pinecone 构建 AI 应用

索引统计

index.describe_index_stats()
{'dimension': 1536,
 'index_fullness': 0.0,
 'namespaces': {},
 'total_vector_count': 0}
使用 Pinecone 构建 AI 应用

命名空间

 

  • 用于对索引进行分区的容器
    • 数据集分离
    • 数据版本管理
    • 分组隔离

 

目前先聚焦单一命名空间

包含多个命名空间的索引。

使用 Pinecone 构建 AI 应用

组织

一个组织包含两个项目,每个都有各自的索引。

使用 Pinecone 构建 AI 应用

组织

一组组织所有者。

  • 跨整个组织的权限
  • 管理账单、用户和所有项目

一位所有者及其下属的多个用户。

  • 受限的组织级权限
  • 被邀请到特定项目
  • 成为这些项目的所有者
使用 Pinecone 构建 AI 应用

删除索引

pc.delete_index('datacamp-index')


pc.list_indexes()
{'indexes': []}
使用 Pinecone 构建 AI 应用

Passons à la pratique !

使用 Pinecone 构建 AI 应用

Preparing Video For Download...