@agentionai/agents 1.10.1 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -82,6 +82,13 @@ type LlamaCppConfig = Omit<OpenAICompatibleConfig, "baseURL" | "model" | "vendor
|
|
|
82
82
|
export declare class LlamaCppAgent extends OpenAICompatibleAgent {
|
|
83
83
|
constructor(config: LlamaCppConfig, history?: History);
|
|
84
84
|
protected getVendorName(): string;
|
|
85
|
+
/**
|
|
86
|
+
* `reasoning_control: true` opts the completion into `llama-server`'s
|
|
87
|
+
* `/chat/completions/control` endpoint — without it, a `reasoning_end`
|
|
88
|
+
* control call is silently ignored and the model keeps thinking. See
|
|
89
|
+
* {@link skipReasoning}.
|
|
90
|
+
*/
|
|
91
|
+
protected buildExtraRequestParams(): Record<string, unknown>;
|
|
85
92
|
/**
|
|
86
93
|
* List the models the server offers, adding the two things llama.cpp reports
|
|
87
94
|
* beyond the OpenAI-standard fields:
|
|
@@ -108,9 +115,12 @@ export declare class LlamaCppAgent extends OpenAICompatibleAgent {
|
|
|
108
115
|
* A no-op if no streamed completion is in flight yet (`lastChunkId` unset).
|
|
109
116
|
* Best-effort: a failed request is logged (when `debug` is on) rather than
|
|
110
117
|
* thrown, since this is a side channel to a turn that should otherwise
|
|
111
|
-
* proceed normally.
|
|
118
|
+
* proceed normally. The endpoint reports failure (e.g. a completion that
|
|
119
|
+
* already finished) as `{success: false}` inside a 200 response rather than
|
|
120
|
+
* an HTTP error, so a non-throwing rejection has to be read from the body.
|
|
112
121
|
*/
|
|
113
122
|
skipReasoning(): Promise<void>;
|
|
123
|
+
private logSkipReasoningFailure;
|
|
114
124
|
}
|
|
115
125
|
export {};
|
|
116
126
|
//# sourceMappingURL=LlamaCppAgent.d.ts.map
|
|
@@ -39,6 +39,15 @@ class LlamaCppAgent extends OpenAICompatibleAgent_1.OpenAICompatibleAgent {
|
|
|
39
39
|
getVendorName() {
|
|
40
40
|
return "llama.cpp";
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* `reasoning_control: true` opts the completion into `llama-server`'s
|
|
44
|
+
* `/chat/completions/control` endpoint — without it, a `reasoning_end`
|
|
45
|
+
* control call is silently ignored and the model keeps thinking. See
|
|
46
|
+
* {@link skipReasoning}.
|
|
47
|
+
*/
|
|
48
|
+
buildExtraRequestParams() {
|
|
49
|
+
return { reasoning_control: true };
|
|
50
|
+
}
|
|
42
51
|
/**
|
|
43
52
|
* List the models the server offers, adding the two things llama.cpp reports
|
|
44
53
|
* beyond the OpenAI-standard fields:
|
|
@@ -77,13 +86,15 @@ class LlamaCppAgent extends OpenAICompatibleAgent_1.OpenAICompatibleAgent {
|
|
|
77
86
|
* A no-op if no streamed completion is in flight yet (`lastChunkId` unset).
|
|
78
87
|
* Best-effort: a failed request is logged (when `debug` is on) rather than
|
|
79
88
|
* thrown, since this is a side channel to a turn that should otherwise
|
|
80
|
-
* proceed normally.
|
|
89
|
+
* proceed normally. The endpoint reports failure (e.g. a completion that
|
|
90
|
+
* already finished) as `{success: false}` inside a 200 response rather than
|
|
91
|
+
* an HTTP error, so a non-throwing rejection has to be read from the body.
|
|
81
92
|
*/
|
|
82
93
|
async skipReasoning() {
|
|
83
94
|
if (!this.lastChunkId)
|
|
84
95
|
return;
|
|
85
96
|
try {
|
|
86
|
-
await fetch(`${this.config.baseURL}/chat/completions/control`, {
|
|
97
|
+
const res = await fetch(`${this.config.baseURL}/chat/completions/control`, {
|
|
87
98
|
method: "POST",
|
|
88
99
|
headers: { "Content-Type": "application/json" },
|
|
89
100
|
body: JSON.stringify({
|
|
@@ -92,11 +103,18 @@ class LlamaCppAgent extends OpenAICompatibleAgent_1.OpenAICompatibleAgent {
|
|
|
92
103
|
model: this.config.model,
|
|
93
104
|
}),
|
|
94
105
|
});
|
|
106
|
+
const body = (await res.json().catch(() => undefined));
|
|
107
|
+
if (!res.ok || body?.success === false) {
|
|
108
|
+
this.logSkipReasoningFailure(body?.message ?? `HTTP ${res.status}`);
|
|
109
|
+
}
|
|
95
110
|
}
|
|
96
111
|
catch (error) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
112
|
+
this.logSkipReasoningFailure(error instanceof Error ? error.message : "Unknown error");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
logSkipReasoningFailure(reason) {
|
|
116
|
+
if (this.debug) {
|
|
117
|
+
console.error(`Failed to signal reasoning_end to ${this.getVendorName()}: ${reason}`);
|
|
100
118
|
}
|
|
101
119
|
}
|
|
102
120
|
}
|