Skip to content
cccskills
FreePublished on GitHub

pinecone

Banco de dados vetorial gerenciado para aplicações de IA em produção. Totalmente gerenciado, com auto-scaling, busca híbrida (vetores densos + esparsos), filtragem de metadados e namespaces. Latência baixa (<100ms p95). Use para RAG em produção, sistemas de recomendação ou busca semântica em escala. Ideal para infraestrutura serverless e gerenciada.

The English summary is being prepared. Showing the original description.

Works withOpenAI
See how to install

Files included (2)

  • SKILL.md8.1 KB
  • references/deployment.md3.5 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Pinecone - Banco de Dados Vetorial Gerenciado

O banco de dados vetorial para aplicações de IA em produção.

Quando usar Pinecone

Use quando:

  • Precisar de banco de dados vetorial gerenciado e serverless
  • Aplicações RAG em produção
  • Auto-scaling necessário
  • Latência baixa crítica (<100ms)
  • Não quiser gerenciar infraestrutura
  • Precisar de busca híbrida (vetores densos + esparsos)

Métricas:

  • SaaS totalmente gerenciado
  • Auto-scales para bilhões de vetores
  • p95 latência <100ms
  • SLA de 99,9% uptime

Use alternativas em vez disso:

  • Chroma: Auto-hospedado, open-source
  • FAISS: Offline, busca de similaridade pura
  • Weaviate: Auto-hospedado com mais recursos

Quick start

Instalação

pip install pinecone-client

Uso básico

from pinecone import Pinecone, ServerlessSpec

# Inicializar
pc = Pinecone(api_key="your-api-key")

# Criar índice
pc.create_index(
    name="my-index",
    dimension=1536,  # Deve corresponder à dimensão de embedding
    metric="cosine",  # ou "euclidean", "dotproduct"
    spec=ServerlessSpec(cloud="aws", region="us-east-1")
)

# Conectar ao índice
index = pc.Index("my-index")

# Fazer upsert de vetores
index.upsert(vectors=[
    {"id": "vec1", "values": [0.1, 0.2, ...], "metadata": {"category": "A"}},
    {"id": "vec2", "values": [0.3, 0.4, ...], "metadata": {"category": "B"}}
])

# Consultar
results = index.query(
    vector=[0.1, 0.2, ...],
    top_k=5,
    include_metadata=True
)

print(results["matches"])

Operações principais

Criar índice

# Serverless (recomendado)
pc.create_index(
    name="my-index",
    dimension=1536,
    metric="cosine",
    spec=ServerlessSpec(
        cloud="aws",         # ou "gcp", "azure"
        region="us-east-1"
    )
)

# Baseado em pod (para performance consistente)
from pinecone import PodSpec

pc.create_index(
    name="my-index",
    dimension=1536,
    metric="cosine",
    spec=PodSpec(
        environment="us-east1-gcp",
        pod_type="p1.x1"
    )
)

Fazer upsert de vetores

# Upsert único
index.upsert(vectors=[
    {
        "id": "doc1",
        "values": [0.1, 0.2, ...],  # 1536 dimensões
        "metadata": {
            "text": "Conteúdo do documento",
            "category": "tutorial",
            "timestamp": "2025-01-01"
        }
    }
])

# Upsert em lote (recomendado)
vectors = [
    {"id": f"vec{i}", "values": embedding, "metadata": metadata}
    for i, (embedding, metadata) in enumerate(zip(embeddings, metadatas))
]

index.upsert(vectors=vectors, batch_size=100)

Consultar vetores

# Consulta básica
results = index.query(
    vector=[0.1, 0.2, ...],
    top_k=10,
    include_metadata=True,
    include_values=False
)

# Com filtragem de metadados
results = index.query(
    vector=[0.1, 0.2, ...],
    top_k=5,
    filter={"category": {"$eq": "tutorial"}}
)

# Consulta de namespace
results = index.query(
    vector=[0.1, 0.2, ...],
    top_k=5,
    namespace="production"
)

# Acessar resultados
for match in results["matches"]:
    print(f"ID: {match['id']}")
    print(f"Score: {match['score']}")
    print(f"Metadata: {match['metadata']}")

Filtragem de metadados

# Correspondência exata
filter = {"category": "tutorial"}

# Comparação
filter = {"price": {"$gte": 100}}  # $gt, $gte, $lt, $lte, $ne

# Operadores lógicos
filter = {
    "$and": [
        {"category": "tutorial"},
        {"difficulty": {"$lte": 3}}
    ]
}  # Também: $or

# Operador in
filter = {"tags": {"$in": ["python", "ml"]}}

Namespaces

# Particionar dados por namespace
index.upsert(
    vectors=[{"id": "vec1", "values": [...]}],
    namespace="user-123"
)

# Consultar namespace específico
results = index.query(
    vector=[...],
    namespace="user-123",
    top_k=5
)

# Listar namespaces
stats = index.describe_index_stats()
print(stats['namespaces'])

Busca híbrida (denso + esparso)

# Fazer upsert com vetores esparsos
index.upsert(vectors=[
    {
        "id": "doc1",
        "values": [0.1, 0.2, ...],  # Vetor denso
        "sparse_values": {
            "indices": [10, 45, 123],  # IDs de token
            "values": [0.5, 0.3, 0.8]   # Pontuações TF-IDF
        },
        "metadata": {"text": "..."}
    }
])

# Consulta híbrida
results = index.query(
    vector=[0.1, 0.2, ...],
    sparse_vector={
        "indices": [10, 45],
        "values": [0.5, 0.3]
    },
    top_k=5,
    alpha=0.5  # 0=esparso, 1=denso, 0.5=híbrido
)

Integração com LangChain

from langchain_pinecone import PineconeVectorStore
from langchain_openai import OpenAIEmbeddings

# Criar vector store
vectorstore = PineconeVectorStore.from_documents(
    documents=docs,
    embedding=OpenAIEmbeddings(),
    index_name="my-index"
)

# Consultar
results = vectorstore.similarity_search("query", k=5)

# Com filtro de metadados
results = vectorstore.similarity_search(
    "query",
    k=5,
    filter={"category": "tutorial"}
)

# Como retriever
retriever = vectorstore.as_retriever(search_kwargs={"k": 10})

Integração com LlamaIndex

from llama_index.vector_stores.pinecone import PineconeVectorStore

# Conectar ao Pinecone
pc = Pinecone(api_key="your-key")
pinecone_index = pc.Index("my-index")

# Criar vector store
vector_store = PineconeVectorStore(pinecone_index=pinecone_index)

# Usar no LlamaIndex
from llama_index.core import StorageContext, VectorStoreIndex

storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = VectorStoreIndex.from_documents(documents, storage_context=storage_context)

Gerenciamento de índices

# Listar índices
indexes = pc.list_indexes()

# Descrever índice
index_info = pc.describe_index("my-index")
print(index_info)

# Obter estatísticas do índice
stats = index.describe_index_stats()
print(f"Total de vetores: {stats['total_vector_count']}")
print(f"Namespaces: {stats['namespaces']}")

# Deletar índice
pc.delete_index("my-index")

Deletar vetores

# Deletar por ID
index.delete(ids=["vec1", "vec2"])

# Deletar por filtro
index.delete(filter={"category": "old"})

# Deletar tudo em um namespace
index.delete(delete_all=True, namespace="test")

# Deletar índice inteiro
index.delete(delete_all=True)

Melhores práticas

  1. Use serverless - Auto-scaling, custo-efetivo
  2. Faça batch upserts - Mais eficiente (100-200 por lote)
  3. Adicione metadados - Habilite filtragem
  4. Use namespaces - Isole dados por usuário/tenant
  5. Monitore o uso - Verifique o dashboard do Pinecone
  6. Otimize filtros - Indexe campos frequentemente filtrados
  7. Teste com tier gratuito - 1 índice, 100K vetores grátis
  8. Use busca híbrida - Melhor qualidade
  9. Defina dimensões apropriadas - Corresponda ao modelo de embedding
  10. Faça backups regulares - Exporte dados importantes

Performance

OperaçãoLatênciaNotas
Upsert~50-100msPor lote
Query (p50)~50msDepende do tamanho do índice
Query (p95)~100msMeta de SLA
Filtro de metadados~+10-20msOverhead adicional

Preços (a partir de 2025)

Serverless:

  • R$ 0,096 por milhão de unidades de leitura
  • R$ 0,06 por milhão de unidades de escrita
  • R$ 0,06 por GB armazenamento/mês

Tier gratuito:

  • 1 índice serverless
  • 100K vetores (1536 dimensões)
  • Ótimo para prototipagem

Recursos

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Especialista em construir experiências 3D para a web - Three.js, React Three Fiber, Spline, WebGL e cenas 3D interativas. Cobre configuradores de produtos, portfólios 3D, websites imersivos e adição de profundidade às experiências web. Use quando: website 3D, three.js, WebGL, react three fiber, experiência 3D.

The English summary is being prepared. Showing the original description.

artubss/SKILLS-CLAUDE-CODE11Updated May 17, 2026

Quando o usuário quer planejar, projetar ou implementar um teste A/B ou experimento. Também use quando o usuário menciona "teste A/B", "split test", "experimento", "testar essa mudança", "copy variante", "teste multivariado" ou "hipótese". Para implementação de rastreamento, veja analytics-tracking.

The English summary is being prepared. Showing the original description.

artubss/SKILLS-CLAUDE-CODE11Updated May 17, 2026

Auditar e melhorar a acessibilidade web seguindo as diretrizes WCAG 2.1. Use quando solicitado para "melhorar acessibilidade", "auditoria a11y", "conformidade WCAG", "suporte a leitor de tela", "navegação por teclado" ou "tornar acessível".

The English summary is being prepared. Showing the original description.

artubss/SKILLS-CLAUDE-CODE11Updated May 17, 2026

Testes e benchmarking de agentes LLM incluindo testes comportamentais, avaliação de capacidades, métricas de confiabilidade e monitoramento em produção—onde até os melhores agentes alcançam menos de 50% em benchmarks do mundo real. Use quando: testes de agentes, avaliação de agentes, benchmark de agentes, confiabilidade de agentes, teste de agentes.

The English summary is being prepared. Showing the original description.

artubss/SKILLS-CLAUDE-CODE11Updated May 17, 2026

Criar, gerenciar e orquestrar agentes de IA usando o CLI AI Maestro. Use quando o usuário pedir para "criar agente", "listar agentes", "deletar agente", "hibernar agente", "despertar agente", "instalar plugin", "mostrar agente", "reiniciar agente" ou qualquer tarefa de gerenciamento do ciclo de vida do agente.

The English summary is being prepared. Showing the original description.

artubss/SKILLS-CLAUDE-CODE11Updated May 17, 2026

Gerencie múltiplos agentes CLI locais via sessões tmux (iniciar/parar/monitorar/atribuir) com agendamento compatível com cron.

The English summary is being prepared. Showing the original description.

artubss/SKILLS-CLAUDE-CODE11Updated May 17, 2026

See all skills by artubss

Report a problem with this skill