Skip to content

Commit 503da0a

Browse files
authored
Merge branch 'main' into dependabot/docker/vllm/vllm/vllm-openai-cpu-v0.27.1
2 parents 7b6587d + ac119ca commit 503da0a

32 files changed

Lines changed: 870 additions & 7 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
meta {
2+
name: Get Health
3+
type: http
4+
seq: 2
5+
}
6+
7+
get {
8+
url: {{baseUrl}}/v1alpha/admin/health
9+
body: none
10+
auth: inherit
11+
}
12+
13+
tests {
14+
test("Status is 200", function() {
15+
expect(res.getStatus()).to.eql(200);
16+
});
17+
test("Status is OK", function() {
18+
const body = res.getBody();
19+
expect(body).to.have.property("status");
20+
expect(body.status).to.eql("OK");
21+
});
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
meta {
2+
name: Get Version
3+
type: http
4+
seq: 1
5+
}
6+
7+
get {
8+
url: {{baseUrl}}/v1alpha/admin/version
9+
body: none
10+
auth: inherit
11+
}
12+
13+
tests {
14+
test("Status is 200", function() {
15+
expect(res.getStatus()).to.eql(200);
16+
});
17+
test("Response has version string", function() {
18+
const body = res.getBody();
19+
expect(body).to.have.property("version");
20+
expect(body.version).to.be.a("string");
21+
});
22+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
meta {
2+
name: List Routes
3+
type: http
4+
seq: 4
5+
}
6+
7+
get {
8+
url: {{baseUrl}}/v1alpha/admin/inspect/routes
9+
body: none
10+
auth: inherit
11+
}
12+
13+
tests {
14+
test("Status is 200", function() {
15+
expect(res.getStatus()).to.eql(200);
16+
});
17+
test("Response has routes array", function() {
18+
const body = res.getBody();
19+
expect(body).to.have.property("data");
20+
expect(body.data).to.be.an("array");
21+
expect(body.data.length).to.be.greaterThan(0);
22+
});
23+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
meta {
2+
name: Get Model
3+
type: http
4+
seq: 2
5+
}
6+
7+
get {
8+
url: {{baseUrl}}/v1/models/{{model}}
9+
body: none
10+
auth: inherit
11+
}
12+
13+
script:pre-request {
14+
const model = bru.getEnvVar("model");
15+
if (!/^[a-zA-Z0-9.\-_\/]+$/.test(model)) {
16+
throw new Error("Invalid model identifier: " + model);
17+
}
18+
}
19+
20+
tests {
21+
test("Status is 200", function() {
22+
expect(res.getStatus()).to.eql(200);
23+
});
24+
test("Response has matching model identifier", function() {
25+
const body = res.getBody();
26+
expect(body).to.have.property("identifier");
27+
expect(body.identifier).to.be.a("string");
28+
expect(body.identifier).to.eql(bru.getEnvVar("model"));
29+
});
30+
}

tests/functional/bruno/ogx-api/01-admin/List Models.bru renamed to tests/functional/bruno/ogx-api/02-models/List Models.bru

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
meta {
22
name: List Models
33
type: http
4-
seq: 4
4+
seq: 1
55
}
66

77
get {
@@ -14,22 +14,23 @@ tests {
1414
test("Status is 200", function() {
1515
expect(res.getStatus()).to.eql(200);
1616
});
17-
18-
test("Response has models array", function() {
17+
test("Response has data array", function() {
1918
const body = res.getBody();
2019
expect(body).to.have.property("data");
2120
expect(body.data).to.be.an("array");
2221
expect(body.data.length).to.be.greaterThan(0);
22+
body.data.forEach(item => {
23+
expect(item).to.be.an("object");
24+
expect(item).to.have.property("id").that.is.a("string");
25+
});
2326
});
24-
25-
test("Inference model is registered", function() {
27+
test("Configured inference model is registered", function() {
2628
const model = bru.getEnvVar("model");
2729
expect(model).to.be.a("string").and.not.empty;
2830
const ids = res.getBody().data.map(m => m.id);
2931
expect(ids).to.include(model);
3032
});
31-
32-
test("Embedding model is registered", function() {
33+
test("Configured embedding model is registered", function() {
3334
const model = bru.getEnvVar("embedding_model");
3435
expect(model).to.be.a("string").and.not.empty;
3536
const ids = res.getBody().data.map(m => m.id);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
meta {
2+
name: Create Chat Completion
3+
type: http
4+
seq: 1
5+
}
6+
7+
post {
8+
url: {{baseUrl}}/v1/chat/completions
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"model": "{{model}}",
16+
"messages": [
17+
{
18+
"role": "user",
19+
"content": "Say hello in one word."
20+
}
21+
],
22+
"max_tokens": 16
23+
}
24+
}
25+
26+
script:pre-request {
27+
const model = bru.getEnvVar("model");
28+
if (!/^[a-zA-Z0-9.\-_\/]+$/.test(model)) {
29+
throw new Error("Invalid model identifier: " + model);
30+
}
31+
}
32+
33+
tests {
34+
test("Status is 200", function() {
35+
expect(res.getStatus()).to.eql(200);
36+
});
37+
test("Response has choices array", function() {
38+
const body = res.getBody();
39+
expect(body).to.have.property("choices");
40+
expect(body.choices).to.be.an("array");
41+
expect(body.choices.length).to.be.greaterThan(0);
42+
});
43+
test("First choice has message content", function() {
44+
const body = res.getBody();
45+
const msg = body.choices[0].message;
46+
expect(msg).to.have.property("content");
47+
expect(msg.content).to.be.a("string");
48+
});
49+
test("Response model matches configured model", function() {
50+
const body = res.getBody();
51+
expect(body).to.have.property("model");
52+
expect(body.model).to.eql(bru.getEnvVar("model"));
53+
});
54+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
meta {
2+
name: Create Embedding
3+
type: http
4+
seq: 4
5+
}
6+
7+
post {
8+
url: {{baseUrl}}/v1/embeddings
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"model": "{{embedding_model}}",
16+
"input": "OGX functional test embedding",
17+
"encoding_format": "float"
18+
}
19+
}
20+
21+
tests {
22+
test("Status is 200", function() {
23+
expect(res.getStatus()).to.eql(200);
24+
});
25+
test("Response has data array", function() {
26+
const body = res.getBody();
27+
expect(body).to.have.property("data");
28+
expect(body.data).to.be.an("array");
29+
expect(body.data.length).to.be.greaterThan(0);
30+
});
31+
test("First embedding has correct structure", function() {
32+
const item = res.getBody().data[0];
33+
expect(item).to.have.property("embedding");
34+
expect(item.embedding).to.be.an("array");
35+
expect(item.embedding.length).to.be.greaterThan(0);
36+
});
37+
test("Embedding dimension matches configured value", function() {
38+
const item = res.getBody().data[0];
39+
const expectedDim = Number(bru.getEnvVar("embedding_dimension"));
40+
expect(Number.isSafeInteger(expectedDim)).to.eql(true);
41+
expect(expectedDim).to.be.greaterThan(0);
42+
expect(item.embedding.length).to.eql(expectedDim);
43+
});
44+
test("Response model matches configured embedding model", function() {
45+
const body = res.getBody();
46+
expect(body).to.have.property("model");
47+
expect(body.model).to.eql(bru.getEnvVar("embedding_model"));
48+
});
49+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
meta {
2+
name: Create Text Completion
3+
type: http
4+
seq: 3
5+
}
6+
7+
post {
8+
url: {{baseUrl}}/v1/completions
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"model": "{{model}}",
16+
"prompt": "The capital of France is",
17+
"max_tokens": 32,
18+
"temperature": 0
19+
}
20+
}
21+
22+
tests {
23+
test("Status is 200", function() {
24+
expect(res.getStatus()).to.eql(200);
25+
});
26+
test("Response has choices array", function() {
27+
const body = res.getBody();
28+
expect(body).to.have.property("choices");
29+
expect(body.choices).to.be.an("array");
30+
expect(body.choices.length).to.be.greaterThan(0);
31+
});
32+
test("First choice has text content", function() {
33+
const body = res.getBody();
34+
expect(body.choices[0]).to.have.property("text");
35+
expect(body.choices[0].text).to.be.a("string");
36+
});
37+
test("Response model matches configured model", function() {
38+
const body = res.getBody();
39+
expect(body).to.have.property("model");
40+
expect(body.model).to.eql(bru.getEnvVar("model"));
41+
});
42+
test("Response contains expected keyword", function() {
43+
const text = res.getBody().choices[0].text.toLowerCase();
44+
expect(text).to.include("paris");
45+
});
46+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
meta {
2+
name: List Chat Completions
3+
type: http
4+
seq: 2
5+
}
6+
7+
get {
8+
url: {{baseUrl}}/v1/chat/completions
9+
body: none
10+
auth: inherit
11+
}
12+
13+
tests {
14+
test("Status is 200", function() {
15+
expect(res.getStatus()).to.eql(200);
16+
});
17+
test("Response has data array", function() {
18+
const body = res.getBody();
19+
expect(body).to.have.property("data");
20+
expect(body.data).to.be.an("array");
21+
});
22+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
meta {
2+
name: Create File
3+
type: http
4+
seq: 1
5+
}
6+
7+
post {
8+
url: {{baseUrl}}/v1/files
9+
body: multipartForm
10+
auth: inherit
11+
}
12+
13+
body:multipart-form {
14+
file: @file(test-upload.txt)
15+
purpose: assistants
16+
}
17+
18+
tests {
19+
test("Status is 200 or 201", function() {
20+
expect([200, 201]).to.include(res.getStatus());
21+
});
22+
test("File created and ID saved", function() {
23+
const body = res.getBody();
24+
expect(body).to.have.property("id");
25+
expect(body.id).to.be.a("string");
26+
bru.setVar("file_id", body.id);
27+
});
28+
}

0 commit comments

Comments
 (0)