.
This commit is contained in:
1 parent
7fa293c9e8
commit
ae44aa03db
67 files changed
+6164
-243
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { buildHermesRequest, normalizeProviderResponse } from "./shared.js";
|
||||
import type { ProviderAdapter } from "./types.js";
|
||||
|
||||
export const llamaProvider: ProviderAdapter = {
|
||||
name: "llama",
|
||||
capabilities: {
|
||||
jsonMode: false,
|
||||
promptCache: false,
|
||||
toolCalls: "hermes",
|
||||
},
|
||||
createHealthUrl(endpoint: string): string {
|
||||
try {
|
||||
const url = new URL(endpoint);
|
||||
url.pathname = "/health";
|
||||
url.search = "";
|
||||
url.hash = "";
|
||||
return url.toString();
|
||||
} catch {
|
||||
if (endpoint.includes("/v1/chat/completions")) {
|
||||
return `${endpoint.split("/v1/chat/completions")[0]}/health`;
|
||||
}
|
||||
return `${endpoint.replace(/\/+$/u, "")}/health`;
|
||||
}
|
||||
},
|
||||
prepareRequest(input) {
|
||||
return buildHermesRequest(input);
|
||||
},
|
||||
supportsHealthCheck: true,
|
||||
toResult(payload, endpoint) {
|
||||
return normalizeProviderResponse(payload, endpoint, "llama");
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user