-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbash.sh
More file actions
48 lines (39 loc) · 1.85 KB
/
Copy pathbash.sh
File metadata and controls
48 lines (39 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#
# Reference requests for both endpoints. This is a cheat-sheet, not a runnable
# suite — copy the command you need. Assumes the server is on :3000.
# --- Ingest a PDF -----------------------------------------------------------
# Linux / macOS
curl -X POST http://localhost:3000/ingest -F "file=@test.pdf"
# Windows PowerShell
curl.exe -X POST http://localhost:3000/ingest -F "file=@test.pdf"
# Response:
# { "message": "Ingested 8 chunks from \"test.pdf\"" }
# --- Ask a question ---------------------------------------------------------
# Linux / macOS
curl -X POST http://localhost:3000/chat \
-H "Content-Type: application/json" \
-d '{ "question": "How should I handle errors in async functions?" }'
# Windows PowerShell
curl.exe -X POST http://localhost:3000/chat -H "Content-Type: application/json" -d "{\"question\": \"How should I handle errors in async functions?\"}"
# --- Reading the results ----------------------------------------------------
# A question the document actually answers scores well:
#
# curl -X POST http://localhost:3000/chat \
# -H "Content-Type: application/json" \
# -d '{ "question": "Webhook responded" }'
#
# {"answer":"Webhook responded with status code 400.",
# "sources":["test.pdf"],"topSimilarity":"0.694"}
#
# A question it does not answer scores poorly, and the model says so rather
# than inventing an answer — topSimilarity 0.521, and the reply opens with
# "the context provided does not contain information about ...".
#
# Rule of thumb for topSimilarity:
# > 0.7 retrieval found genuinely relevant chunks
# < 0.5 retrieval struggled; it matched keywords, not meaning
#
# Worth testing deliberately: ask about something the PDF never mentions. The
# model should decline rather than guess. That is the behaviour you want in
# production, and it comes from the system prompt in src/embeddings.js.