Skip to content

Commit 8b670e9

Browse files
committed
with schemas this time
1 parent b962301 commit 8b670e9

File tree

3 files changed

+129
-3
lines changed

3 files changed

+129
-3
lines changed

bin/fetch-ai-models.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from "fs";
33
fetch("https://ai.cloudflare.com/api/models")
44
.then((res) => res.json())
55
.then((data) => {
6-
data.models.forEach((model) => {
6+
data.models.map((model) => {
77
const fileName = model.name.split("/")[2];
88
fs.writeFileSync(
99
`./src/content/workers-ai-models/${fileName}.json`,

src/content/workers-ai-models/bge-m3.json

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,74 @@
1010
},
1111
"tags": [],
1212
"properties": [],
13-
"schema": {}
13+
"schema": {
14+
"input": {
15+
"type": "object",
16+
"properties": {
17+
"query": {
18+
"type": "string",
19+
"minLength": 1,
20+
"description": "A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts"
21+
},
22+
"contexts": {
23+
"type": "array",
24+
"items": {
25+
"type": "object",
26+
"properties": {
27+
"text": {
28+
"type": "string",
29+
"minLength": 1,
30+
"description": "One of the provided context content"
31+
}
32+
}
33+
},
34+
"description": "List of provided contexts. Note that the index in this array is important, as the response will refer to it."
35+
}
36+
},
37+
"required": [
38+
"contexts"
39+
]
40+
},
41+
"output": {
42+
"type": "object",
43+
"contentType": "application/json",
44+
"oneOf": [
45+
{
46+
"title": "Query",
47+
"properties": {
48+
"response": {
49+
"type": "array",
50+
"items": {
51+
"type": "object",
52+
"properties": {
53+
"id": {
54+
"type": "integer",
55+
"description": "Index of the context in the request"
56+
},
57+
"score": {
58+
"type": "number",
59+
"description": "Score of the context under the index."
60+
}
61+
}
62+
}
63+
}
64+
}
65+
},
66+
{
67+
"title": "Embedding",
68+
"properties": {
69+
"response": {
70+
"type": "array",
71+
"items": {
72+
"type": "array",
73+
"items": {
74+
"type": "number"
75+
}
76+
}
77+
}
78+
}
79+
}
80+
]
81+
}
82+
}
1483
}

src/content/workers-ai-models/bge-reranker-base.json

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,62 @@
1010
},
1111
"tags": [],
1212
"properties": [],
13-
"schema": {}
13+
"schema": {
14+
"input": {
15+
"type": "object",
16+
"properties": {
17+
"query": {
18+
"type": "string",
19+
"minLength": 1,
20+
"description": "A query you wish to perform against the provided contexts."
21+
},
22+
"top_k": {
23+
"type": "integer",
24+
"default": null,
25+
"minimum": 1,
26+
"description": "Number of returned results starting with the best score."
27+
},
28+
"contexts": {
29+
"type": "array",
30+
"items": {
31+
"type": "object",
32+
"properties": {
33+
"text": {
34+
"type": "string",
35+
"minLength": 1,
36+
"description": "One of the provided context content"
37+
}
38+
}
39+
},
40+
"description": "List of provided contexts. Note that the index in this array is important, as the response will refer to it."
41+
}
42+
},
43+
"required": [
44+
"query",
45+
"contexts"
46+
]
47+
},
48+
"output": {
49+
"type": "object",
50+
"contentType": "application/json",
51+
"properties": {
52+
"response": {
53+
"type": "array",
54+
"items": {
55+
"type": "object",
56+
"properties": {
57+
"id": {
58+
"type": "integer",
59+
"description": "Index of the context in the request"
60+
},
61+
"score": {
62+
"type": "number",
63+
"description": "Score of the context under the index."
64+
}
65+
}
66+
}
67+
}
68+
}
69+
}
70+
}
1471
}

0 commit comments

Comments
 (0)