cat > ingest-collection.py << 'EOF'
#!/usr/bin/env python3
import requests
import json
BASE_URL = "http://localhost:8001/ai-rag-injector/b924e3e8-7893-4706-aacb-e75793a1d2e9/ingest_chunk"
chunks = [
{
"content": "Public Investor FAQ: Our fiscal year ends December 31st. Quarterly earnings calls occur in January, April, July, and October. All public filings are available on our investor relations website. For questions, contact investor.relations@company.com.",
"metadata": {
"collection": "public-docs",
"source": "website",
"date": "2024-01-15T00:00:00Z",
"tags": ["public", "investor-relations", "faq"]
}
},
{
"content": "Q4 2024 Financial Results: Revenue increased 15% year-over-year to $2.3B. Operating margin improved to 24%, up from 21% in Q3. Key drivers included strong enterprise sales and improved operational efficiency.",
"metadata": {
"collection": "finance-reports",
"source": "internal",
"date": "2024-10-14T00:00:00Z",
"tags": ["finance", "quarterly", "q4", "2024"]
}
},
{
"content": "Q3 2024 Financial Results: Revenue reached $2.0B with 12% year-over-year growth. Operating margin held steady at 21%. International markets contributed 35% of total revenue.",
"metadata": {
"collection": "finance-reports",
"source": "internal",
"date": "2024-07-15T00:00:00Z",
"tags": ["finance", "quarterly", "q3", "2024"]
}
},
{
"content": "2023 Annual Report: Full-year revenue totaled $7.8B, representing 18% growth. The company expanded into three new markets and launched five major product updates. Board approved $500M share buyback program.",
"metadata": {
"collection": "finance-reports",
"source": "internal",
"date": "2023-12-31T00:00:00Z",
"tags": ["finance", "annual", "2023"]
}
},
{
"content": "Historical Data Archive: Q2 2022 revenue was $1.5B with 8% growth. This data is retained for historical analysis but may not reflect current business conditions or reporting standards.",
"metadata": {
"collection": "finance-reports",
"source": "archive",
"date": "2022-06-15T00:00:00Z",
"tags": ["finance", "quarterly", "q2", "2022", "archive"]
}
},
{
"content": "CONFIDENTIAL - M&A Discussion: Preliminary valuation for Target Corp acquisition ranges from $400M-$500M. Due diligence reveals strong synergies in enterprise segment. Board vote scheduled for Q1 2025. Legal counsel: Morrison & Associates. Internal deal code: MA-2024-087.",
"metadata": {
"collection": "executive-confidential",
"source": "internal",
"date": "2024-11-20T00:00:00Z",
"tags": ["confidential", "m&a", "executive"]
}
}
]
def ingest_chunks():
headers = {
"Content-Type": "application/json",
"apikey": "admin-key"
}
for i, chunk in enumerate(chunks, 1):
try:
response = requests.post(BASE_URL, json=chunk, headers=headers)
response.raise_for_status()
print(f"[{i}/{len(chunks)}] Ingested: {chunk['content'][:50]}...")
print(response.json())
except requests.exceptions.RequestException as e:
print(f"[{i}/{len(chunks)}] Failed: {e}")
if hasattr(e.response, 'text'):
print(f" Response: {e.response.text}")
if __name__ == "__main__":
ingest_chunks()
EOF