惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
N
Netflix TechBlog - Medium
C
Check Point Blog
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
I
InfoQ
Hugging Face - Blog
Hugging Face - Blog
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理
腾讯CDC
V
Visual Studio Blog
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
V
V2EX
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
U
Unit 42
B
Blog

Pinecone

Pinecone Assistant: A Managed Knowledge Layer for Production AI Applications Multi-domain RAG in n8n: why one knowledge base is not enough Allspice Transforms the Culinary Experience with Semantic Search Powered by Pinecone | Pinecone Building RAG workflows in n8n: choosing the right Pinecone node Knowledge needs a meta-knowledge layer Garbage Day: How Pinecone Safely Deletes Billions of Objects at Scale When "Performance" Means Two Different Things Pinecone BYOC: Pinecone in your AWS, GCP, or Azure account, no vendor access True, Relevant, and Wrong: The Applicability Problem in RAG Use the Pinecone Plugin for Claude Code to develop AI Applications Faster Millions at Stake: How Melange's High-Recall Retrieval Prevents Litigation Collapse Powering High-stakes Patent Search at Scale: How Melange Built a Reliable AI System on Pinecone | Pinecone Pinecone Assistant Node in n8n: Turn Any Data Source Into Knowledge RAG with Access Control Pinecone Dedicated Read Nodes are now in Public Preview Inside Pinecone: Slab Architecture New Bulk Data Operations: Update, Delete, and Fetch by Metadata The Hidden Cost of Building: Lessons from Aquant Simplifying Vector Embeddings with Pinecone Integrated Inference Capabilities Pinecone joins Microsoft Marketplace as a Launch Partner GTM Engineering: Clay + Pinecone for AI-powered Sales Outbound Build an AI knowledge assistant with Google Docs and Pinecone Moving Pinecone forward with Ash Ashutosh as CEO and Edo spearheading our growing AI ambitions as Chief Scientist Pinecone Founder Edo Liberty to Spearhead Pinecone’s Growing AI Ambitions; Appoints Ash Ashutosh as CEO to Expand Vector Database Market Leadership Fast, Accurate Retrieval for Creators at Scale: Delphi’s Path Toward a Million Conversational Agents with Pinecone | Pinecone Announcing Pinecone Pioneers: A Program for Builders, Organizers, and Community Leaders What is Context Engineering? Chunking Strategies for LLM Applications Beyond the hype: Why RAG remains essential for modern AI Obviant Makes 30% More Accurate Defense Acquisition Recommendations Combining Sparse and Dense Retrieval with Pinecone | Pinecone
Streamlining CI/CD with Pinecone Local
Roie Schwaber-Cohen, Bear Douglas, Zachary Proser · 2024-10-02 · via Pinecone

Pinecone Local is an in-memory Pinecone Vector Database emulator available as a Docker image. It provides developers with a powerful tool for local development and testing.

It integrates smoothly into CI/CD environments, allowing efficient and cost-effective testing without a live billing account.

In this article, we’ll explore how you can use Pinecone Local in your GitHub Actions workflows to do API contract testing, reduce costs and speed up your CICD testing jobs.

You can use GitHub Actions and Pinecone Local to build the following workflow, which you can configure to run whenever changes are pushed on a feature branch, or merged to main:

name: Pinecone CI/CD with Local

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'

    - name: Set up Docker
      uses: docker-practice/actions-setup-docker@master

    - name: Start Pinecone Local
      run: |
        docker pull ghcr.io/pinecone-io/pinecone-index:latest
        docker run -d \
          --name pinecone-local \
          -e PORT=5081 \
          -e INDEX_TYPE=serverless \
          -e DIMENSION=768 \
          -e METRIC=cosine \
          -p 5081:5081 \
          --platform linux/amd64 \
          ghcr.io/pinecone-io/pinecone-index:latest

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install "pinecone[grpc]" pytest

    - name: Run tests
      env:
        PINECONE_API_KEY: dummy-key
        PINECONE_ENVIRONMENT: local
        PINECONE_INDEX: my-index
      run: |
        pytest tests/

    - name: Stop Pinecone Local
      run: docker stop pinecone-local

Let's look at a practical example of writing some Python code to run against our Pinecone Local instance.

Next, we run an instance of Pinecone Local, using environment variables to configure its functionality and the port it will listen on:

# Start Pinecone Local with one index - take note of the port mappings
docker run -d \
--name index1 \
-e PORT=5081 \
-e INDEX_TYPE=serverless \
-e DIMENSION=2 \
-e METRIC=cosine \
-p 5081:5081 \
--platform linux/amd64 \
ghcr.io/pinecone-io/pinecone-index:latest
from pinecone.grpc import PineconeGRPC, GRPCClientConfig
import time

# Initialize a client. An API key must be passed, but the 
# value does not matter.
pc = PineconeGRPC(api_key="pclocal")

# Target the indexes. Use the host and port number and disable TLS (SSL) 
# connections since we're going over localhost
index1 = pc.Index(host="localhost:5081", grpc_config=GRPCClientConfig(secure=False))
# Upsert records into index1
index1.upsert(
    vectors=[
        {
            "id": "vec1", 
            "values": [1.0, 1.5],
            "metadata": {"genre": "comedy"}
        },
        {
            "id": "vec2", 
            "values": [2.0, 1.0],
            "metadata": {"genre": "drama"}
        },
        {
            "id": "vec3", 
            "values": [0.1, 3.0],
            "metadata": {"genre": "comedy"}
        }
    ],
    namespace="example-namespace"
)

# Wait for the indexes to be updated
time.sleep(5)

# Check the number of records in each index
print(index1.describe_index_stats())

# Query index2 with a metadata filter
query = index1.query(
    vector=[1.0, 1.5],
    filter={"genre": {"$eq": "comedy"}},
    top_k=1,
    include_values=True,
    include_metadata=True,
    namespace='example-namespace'
)

print(query)
# Output of describe_index_stats call
{'dimension': 2,
 'index_fullness': 0.0,
 'namespaces': {'example-namespace': {'vector_count': 3}},
 'total_vector_count': 3}
 
 # Output of query
{'matches': [{'id': 'vec1',
              'metadata': {'genre': 'comedy'},
              'score': 1.0,
              'sparse_values': {'indices': [], 'values': []},
              'values': [1.0, 1.5]}],
 'namespace': 'example-namespace'}

Pinecone Local offers a powerful solution for integrating vector database testing into CI/CD pipelines. Providing a containerized, in-memory emulator of Pinecone's vector database enables faster, more reliable, and cost-effective testing processes.

Pinecone Local can streamline your development workflow and make building comprehensive test coverage for your projects easier.