aboutsummaryrefslogtreecommitdiff
path: root/apps/cf-ai-backend/README.md
blob: 91d6b77ebb59dcdbd53d9986bce49268f5c701b8 (plain) (blame)
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
49
50
baseURL: https://new-cf-ai-backend.dhravya.workers.dev

Authentication:
You must authenticate with a header and `Authorization: bearer token` for each request in `/api/*` routes.

### Add content:

POST `/api/add` with

```
body {
  pageContent: z.string(),
  title: z.string().optional(),
  description: z.string().optional(),
  space: z.string().optional(),
  url: z.string(),
  user: z.string(),
}
```

### Query without user data

GET `/api/ask` with
query `?query=testing`

(this is temp but works perfectly, will change soon for chat use cases specifically)

### Query vectorize and get results in natural language

POST `/api/chat` with

```
query paramters (?query=...&" {
      query: z.string(),
      topK: z.number().optional().default(10),
      user: z.string(),
      spaces: z.string().optional(),
      sourcesOnly: z.string().optional().default("false"),
      model: z.string().optional().default("gpt-4o"),
    }

body z.object({
  chatHistory: z.array(contentObj).optional(),
});
```

### Delete vectors

DELETE `/api/delete` with
query param websiteUrl, user