pinecone_wow.py
1 """Pinecone Vector Store - Agent-First Example 2 3 Requires: export PINECONE_API_KEY=... 4 """ 5 import os 6 import sys 7 from praisonaiagents import Agent 8 9 api_key = os.getenv("PINECONE_API_KEY") 10 if not api_key: 11 print("SKIPPED: Pinecone - PINECONE_API_KEY not set") 12 sys.exit(0) 13 14 # Agent-first approach: use knowledge parameter with Pinecone 15 agent = Agent( 16 name="Assistant", 17 instructions="You are a helpful assistant with access to documents.", 18 knowledge={ 19 "sources": ["./docs/guide.pdf"], 20 "vector_store": "pinecone", 21 "api_key": api_key, 22 "environment": "us-east-1" 23 } 24 ) 25 26 # Chat - agent uses knowledge for RAG 27 response = agent.chat("What information do you have?") 28 print(f"Response: {response}") 29 30 print("PASSED: Pinecone with Agent") 31 32 # --- Advanced: Direct Store Usage --- 33 # from pinecone import Pinecone 34 # pc = Pinecone(api_key=api_key)