ByeBrief provides local API endpoints for AI model interaction. All endpoints are designed for local-first operation with Ollama.
http://localhost:11434/api
POST /generate
Generate text completion from investigation data.
Request:
{
"model": "llama3.2",
"prompt": "Analyze the following investigation nodes: [nodes JSON]",
"stream": false,
"options": {
"temperature": 0.7,
"top_p": 0.9,
"num_predict": 2048
}
}Response:
{
"model": "llama3.2",
"response": "The analysis shows that...",
"done": true
}POST /chat
Chat completion for interactive analysis.
Request:
{
"model": "llama3.2",
"messages": [
{
"role": "user",
"content": "Analyze these claims for contradictions: [claims]"
}
],
"stream": false
}Response:
{
"model": "llama3.2",
"message": {
"role": "assistant",
"content": "After reviewing the claims..."
},
"done": true
}GET /version
Check Ollama service status.
Response:
{
"version": "0.5.4"
}When sending investigation data to the model, the following JSON structure is used:
interface CanvasNode {
id: string;
type: 'cause' | 'timeline' | 'evidence' | 'person' |
'location' | 'law' | 'note' | 'analysis' |
'hypothesis' | 'conclusion';
position: { x: number; y: number };
data: {
label: string;
content: string;
confidence: 'high' | 'medium' | 'low';
source?: string;
date?: string;
};
}{
"nodes": [
{
"id": "node-1",
"type": "evidence",
"position": { "x": 100, "y": 200 },
"data": {
"label": "Email Records",
"content": "Email from 2024-01-15 shows communication between parties",
"confidence": "high",
"source": "FOIA Request #2024-001"
}
},
{
"id": "node-2",
"type": "person",
"position": { "x": 300, "y": 150 },
"data": {
"label": "John Smith",
"content": "CEO of Company XYZ, present at meeting",
"confidence": "high"
}
}
],
"notes": [
{
"id": "note-1",
"content": "Need to verify timestamp accuracy"
}
],
"edges": [
{
"id": "edge-1",
"source": "node-1",
"target": "node-2"
}
]
}{
"type": "structure-analysis",
"suggestions": [
{
"type": "missing-evidence",
"description": "No timeline events found - add dated entries",
"priority": "high"
},
{
"type": "gap-analysis",
"description": "Missing location data for key events",
"priority": "medium"
}
],
"missingInfo": [
"Timeline nodes",
"Source verification for claim #3"
]
}{
"type": "contradiction-analysis",
"analysis": {
"contradictions": [
{
"claimA": "Witness states meeting was at 2pm",
"claimB": "Email timestamp shows 3pm",
"severity": "high"
}
],
"riskRating": "7/10",
"claimSupportChains": [
{
"claim": "Company knew about issue",
"supporting": ["Email #1", "Meeting notes"],
"strength": "strong"
}
],
"remediationActions": [
"Request email server logs",
"Interview witness about timeline"
]
}
}{
"type": "legal-report",
"content": "EXECUTIVE SUMMARY\n\nThe evidence establishes that Company XYZ...",
"sections": {
"issue": "Whether Company XYZ violated Section 4...",
"rule": "Under Sherman Act Section 4, liability requires...",
"application": "The facts demonstrate that... (see Evidence nodes 1-5)",
"conclusion": "Based on the foregoing, the plaintiff has established..."
},
"metadata": {
"nodesReferenced": ["node-1", "node-2", "node-5"],
"confidence": "high",
"dateGenerated": "2024-03-15T10:30:00Z"
}
}When web search is enabled:
GET https://api.search.brave.com/res/v1/web/search
Headers:
X-Subscription-Token: <your-api-key>
POST https://api.tavily.com/search
Body:
{
"api_key": "<your-api-key>",
"query": "search query",
"max_results": 10
}{
"error": "connection_failed",
"message": "Cannot connect to Ollama at http://localhost:11434",
"suggestion": "Ensure Ollama is running: ollama serve"
}{
"error": "model_not_found",
"message": "Model 'gemma3' not found",
"suggestion": "Pull the model: ollama pull gemma3"
}{
"error": "rate_limit",
"message": "Too many requests",
"retryAfter": 30
}