@vellumai/assistant 0.10.11-staging.1 → 0.10.11
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.
package/package.json
CHANGED
|
@@ -98,6 +98,72 @@ describe("SendMessageOptions.config.overrideProfile", () => {
|
|
|
98
98
|
expect(captured?.config?.callSite).toBe("conversationTitle");
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
+
test("CallSiteConfiguredProvider forwards its stored overrideProfile when the caller sets callSite", async () => {
|
|
102
|
+
let captured: SendMessageOptions | undefined;
|
|
103
|
+
const inner: Provider = {
|
|
104
|
+
name: "anthropic",
|
|
105
|
+
async sendMessage(
|
|
106
|
+
_messages: Message[],
|
|
107
|
+
options?: SendMessageOptions,
|
|
108
|
+
): Promise<ProviderResponse> {
|
|
109
|
+
captured = options;
|
|
110
|
+
return makeResponse("anthropic");
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const provider = new CallSiteConfiguredProvider(
|
|
115
|
+
inner,
|
|
116
|
+
"inference",
|
|
117
|
+
"byok-sonnet",
|
|
118
|
+
);
|
|
119
|
+
await provider.sendMessage(DUMMY_MESSAGES, {
|
|
120
|
+
config: { callSite: "inference" },
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Naming a call site must not opt the caller out of profile propagation:
|
|
124
|
+
// the two fields are independent, and downstream resolution reads the
|
|
125
|
+
// override off the config it is handed.
|
|
126
|
+
expect(captured?.config?.overrideProfile).toBe("byok-sonnet");
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test("a profile-pinned send resolves the profile's model, not the call-site default", async () => {
|
|
130
|
+
setLlmConfig({
|
|
131
|
+
profiles: {
|
|
132
|
+
"balanced-together": {
|
|
133
|
+
provider: "together",
|
|
134
|
+
model: "moonshotai/Kimi-K2-Instruct",
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
let captured: Record<string, unknown> | undefined;
|
|
140
|
+
const inner: Provider = {
|
|
141
|
+
name: "together",
|
|
142
|
+
async sendMessage(
|
|
143
|
+
_messages: Message[],
|
|
144
|
+
options?: SendMessageOptions,
|
|
145
|
+
): Promise<ProviderResponse> {
|
|
146
|
+
captured = options?.config as Record<string, unknown> | undefined;
|
|
147
|
+
return makeResponse("together");
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const provider = new CallSiteConfiguredProvider(
|
|
152
|
+
new RetryProvider(inner),
|
|
153
|
+
"inference",
|
|
154
|
+
"balanced-together",
|
|
155
|
+
);
|
|
156
|
+
await provider.sendMessage(DUMMY_MESSAGES, {
|
|
157
|
+
config: { callSite: "inference" },
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// Losing the override strands a Together connection on the `inference`
|
|
161
|
+
// call-site default (`cost-optimized`), whose model is a Fireworks id —
|
|
162
|
+
// the provider half stays correct, so the upstream 400 names a model the
|
|
163
|
+
// caller never chose.
|
|
164
|
+
expect(captured?.model).toBe("moonshotai/Kimi-K2-Instruct");
|
|
165
|
+
});
|
|
166
|
+
|
|
101
167
|
test("RetryProvider resolves model from named profile when overrideProfile is set", async () => {
|
|
102
168
|
setLlmConfig({
|
|
103
169
|
profiles: {
|
|
@@ -77,15 +77,15 @@ export class CallSiteConfiguredProvider implements Provider {
|
|
|
77
77
|
options?: SendMessageOptions,
|
|
78
78
|
): Promise<ProviderResponse> {
|
|
79
79
|
const config = options?.config;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
// Each field falls back independently. Naming a call site per-call must
|
|
81
|
+
// not suppress the stored override — they are orthogonal, and dropping
|
|
82
|
+
// the override leaves the transport bound to the requested profile while
|
|
83
|
+
// the model resolves from the call-site default.
|
|
84
84
|
return this.inner.sendMessage(messages, {
|
|
85
85
|
...options,
|
|
86
86
|
config: {
|
|
87
87
|
...config,
|
|
88
|
-
callSite: this.callSite,
|
|
88
|
+
callSite: config?.callSite ?? this.callSite,
|
|
89
89
|
...(config?.overrideProfile === undefined &&
|
|
90
90
|
this.overrideProfile !== undefined
|
|
91
91
|
? { overrideProfile: this.overrideProfile }
|