const http = require('http');
const options = {
hostname: '127.0.0.1',
port: 8080,
path: '/health',
method: 'GET',
};
const req = http.request(options, (res) => {
console.log(`STATUS: ${res.statusCode}`);
res.on('data', (chunk) => {
console.log(`BODY: ${chunk}`);
});
});
req.on('error', (e) => {
console.error(`problem with request: ${e.message}`);
});
req.end();
const embeddingOptions = {
hostname: '127.0.0.1',
port: 8080,
path: '/embeddings',
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
};
const embeddingReq = http.request(embeddingOptions, (res) => {
console.log(`EMBEDDING (root) STATUS: ${res.statusCode}`);
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => console.log(`EMBEDDING (root) BODY: ${body}`));
});
embeddingReq.on('error', (e) => {
console.error(`embedding problem: ${e.message}`);
});
embeddingReq.write(JSON.stringify({
content: "test",
model: "ignored"
}));
embeddingReq.end();
const v1Options = {
hostname: '127.0.0.1',
port: 8080,
path: '/v1/embeddings',
method: 'POST',
headers: { 'Content-Type': 'application/json' }
};
const v1Req = http.request(v1Options, (res) => {
console.log(`EMBEDDING (v1) STATUS: ${res.statusCode}`);
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => console.log(`EMBEDDING (v1) BODY: ${body}`));
});
v1Req.on('error', (e) => console.error(e));
v1Req.write(JSON.stringify({
input: "test",
model: "ignored"
}));
v1Req.end();