Files
lolympus-agent/src/llm/providers/llama.ts
T
2026-04-17 00:47:02 -07:00

33 lines
903 B
TypeScript

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");
},
};