smoltalk 0.0.41 → 0.0.43
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/dist/clients/google.js +4 -5
- package/dist/strategies/baseStrategy.d.ts +2 -0
- package/dist/strategies/baseStrategy.js +6 -0
- package/dist/strategies/fallbackStrategy.d.ts +1 -0
- package/dist/strategies/fallbackStrategy.js +3 -0
- package/dist/strategies/idStrategy.d.ts +1 -0
- package/dist/strategies/idStrategy.js +3 -0
- package/dist/strategies/raceStrategy.d.ts +1 -0
- package/dist/strategies/raceStrategy.js +3 -0
- package/dist/strategies/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/clients/google.js
CHANGED
|
@@ -65,11 +65,10 @@ export class SmolGoogle extends BaseClient {
|
|
|
65
65
|
if (tools.length > 0) {
|
|
66
66
|
genConfig.tools = [{ functionDeclarations: tools }];
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (config.responseFormat && tools.length === 0) {
|
|
68
|
+
if (config.responseFormat && tools.length > 0) {
|
|
69
|
+
console.error("Warning: Both responseFormat and tools are specified in the prompt config. Google Gemini does not support enforcing a response format when tools are included, so the responseFormat will be ignored.");
|
|
70
|
+
}
|
|
71
|
+
else if (config.responseFormat && tools.length === 0) {
|
|
73
72
|
genConfig.responseMimeType = "application/json";
|
|
74
73
|
genConfig.responseJsonSchema = config.responseFormat.toJSONSchema();
|
|
75
74
|
}
|
|
@@ -7,4 +7,6 @@ export declare class BaseStrategy implements Strategy {
|
|
|
7
7
|
_text(config: SmolPromptConfig): Promise<Result<PromptResult>>;
|
|
8
8
|
_textSync(config: SmolPromptConfig): Promise<Result<PromptResult>>;
|
|
9
9
|
toJSON(): StrategyJSON;
|
|
10
|
+
toString(): string;
|
|
11
|
+
toShortString(): string;
|
|
10
12
|
}
|
|
@@ -6,6 +6,7 @@ export declare class FallbackStrategy extends BaseStrategy {
|
|
|
6
6
|
config: FallbackStrategyConfig;
|
|
7
7
|
constructor(strategies: Strategy[], config: FallbackStrategyConfig);
|
|
8
8
|
toString(): string;
|
|
9
|
+
toShortString(): string;
|
|
9
10
|
_text(config: SmolPromptConfig): Promise<import("../types.js").Result<import("../types.js").PromptResult> | import("../types.js").Success<{
|
|
10
11
|
output: null;
|
|
11
12
|
toolCalls: never[];
|
|
@@ -12,6 +12,9 @@ export class FallbackStrategy extends BaseStrategy {
|
|
|
12
12
|
toString() {
|
|
13
13
|
return `FallbackStrategy([${this.strategies.map((s) => s.toString()).join(", ")}], config: ${JSON.stringify(this.config)})`;
|
|
14
14
|
}
|
|
15
|
+
toShortString() {
|
|
16
|
+
return `fallback([${this.strategies.map((s) => s.toShortString?.() || s.toString()).join(", ")}])`;
|
|
17
|
+
}
|
|
15
18
|
async _text(config) {
|
|
16
19
|
for (let i = 0; i < this.strategies.length; i++) {
|
|
17
20
|
const strategy = this.strategies[i];
|
|
@@ -6,6 +6,7 @@ export declare class IDStrategy extends BaseStrategy {
|
|
|
6
6
|
model: Model;
|
|
7
7
|
constructor(model: Model);
|
|
8
8
|
toString(): string;
|
|
9
|
+
toShortString(): string;
|
|
9
10
|
_text(_config: SmolPromptConfig): Promise<import("../types.js").Result<import("../types.js").PromptResult>>;
|
|
10
11
|
toJSON(): StrategyJSON;
|
|
11
12
|
}
|
|
@@ -9,6 +9,9 @@ export class IDStrategy extends BaseStrategy {
|
|
|
9
9
|
toString() {
|
|
10
10
|
return `IDStrategy(model: ${this.model.getResolvedModel()})`;
|
|
11
11
|
}
|
|
12
|
+
toShortString() {
|
|
13
|
+
return `id(${this.model.getResolvedModel()})`;
|
|
14
|
+
}
|
|
12
15
|
async _text(_config) {
|
|
13
16
|
const config = {
|
|
14
17
|
..._config,
|
|
@@ -5,6 +5,7 @@ export declare class RaceStrategy extends BaseStrategy {
|
|
|
5
5
|
strategies: Strategy[];
|
|
6
6
|
constructor(strategies: Strategy[]);
|
|
7
7
|
toString(): string;
|
|
8
|
+
toShortString(): string;
|
|
8
9
|
_text(config: SmolPromptConfig): Promise<import("../types.js").Failure | import("../types.js").Success<import("../types.js").PromptResult>>;
|
|
9
10
|
toJSON(): StrategyJSON;
|
|
10
11
|
}
|
|
@@ -8,6 +8,9 @@ export class RaceStrategy extends BaseStrategy {
|
|
|
8
8
|
toString() {
|
|
9
9
|
return `RaceStrategy([${this.strategies.map((s) => s.toString()).join(", ")}])`;
|
|
10
10
|
}
|
|
11
|
+
toShortString() {
|
|
12
|
+
return `race(${this.strategies.map((s) => s.toShortString?.() || s.toString()).join(", ")})`;
|
|
13
|
+
}
|
|
11
14
|
async _text(config) {
|
|
12
15
|
const controllers = this.strategies.map(() => new AbortController());
|
|
13
16
|
// Link to any existing abort signal so external cancellation still works
|
|
@@ -6,6 +6,8 @@ export interface Strategy {
|
|
|
6
6
|
_textSync(config: SmolPromptConfig): Promise<Result<PromptResult>>;
|
|
7
7
|
textStream(config: SmolPromptConfig): Promise<Result<AsyncIterable<PromptResult>>>;
|
|
8
8
|
toJSON(): StrategyJSON;
|
|
9
|
+
toString(): string;
|
|
10
|
+
toShortString(): string;
|
|
9
11
|
}
|
|
10
12
|
type FallbackReason = "error" | "timeout" | "structuredOutputFailure";
|
|
11
13
|
export type FallbackStrategyConfig = {
|