smoltalk 0.0.46 → 0.0.48

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.
@@ -103,7 +103,11 @@ export class SmolGoogle extends BaseClient {
103
103
  // make two requests instead
104
104
  /*********** TOOL CALL REQUEST ************/
105
105
  this.logger.debug("Detected both tool calls and structured response in call to Google Gemini. Making separate request to Google Gemini for tool calls.");
106
- this.statelogClient?.debug("Google Gemini: splitting tool calls and structured response into separate requests", {});
106
+ this.statelogClient?.debug("Detected both tool calls and structured response in call to Google Gemini. Making separate request to Google Gemini for tool calls.", {
107
+ contents: request.contents,
108
+ tools: config.tools,
109
+ responseFormat: config.responseFormat,
110
+ });
107
111
  const toolRequest = {
108
112
  ...request,
109
113
  config: {
@@ -118,12 +122,21 @@ export class SmolGoogle extends BaseClient {
118
122
  }
119
123
  if (toolResult.value.toolCalls.length > 0) {
120
124
  this.logger.debug("Tool calls detected. Returning tool calls without making second request for structured response.");
125
+ this.statelogClient?.debug("Tool calls detected in Google Gemini response, skipping structured response request", {
126
+ toolCalls: toolResult.value.toolCalls,
127
+ });
121
128
  return toolResult;
122
129
  }
123
130
  if (!toolResult.value.output) {
131
+ this.statelogClient?.debug("No output or tool calls detected in Google Gemini response", {
132
+ response: toolResult.value,
133
+ });
124
134
  throw new Error("No output or tool calls detected in Google Gemini response. This should not happen.");
125
135
  }
126
136
  this.logger.debug("No tool calls detected. Making second request to Google Gemini for structured response.");
137
+ this.statelogClient?.debug("No tool calls detected in Google Gemini response. Making second request for structured response.", {
138
+ response: toolResult.value,
139
+ });
127
140
  /*********** STRUCTURED OUTPUT REQUEST ************/
128
141
  const message = userMessage(`Please return this output in the specified structured format. Output: ${toolResult.value.output}`);
129
142
  const messages = [message.toGoogleMessage()];
@@ -5,7 +5,13 @@ export class BaseStrategy {
5
5
  this.statelogClient = config.statelog
6
6
  ? getStatelogClient(config.statelog)
7
7
  : undefined;
8
+ this.statelogClient?.debug("Starting strategy", {
9
+ strategy: this.toString(),
10
+ });
8
11
  if (config.hooks?.onStrategyStart) {
12
+ this.statelogClient?.debug("Calling onStrategyStart hook", {
13
+ strategy: this.toString(),
14
+ });
9
15
  config.hooks.onStrategyStart(this, config);
10
16
  }
11
17
  return this._text({ ...config, strategy: undefined });
@@ -14,6 +20,9 @@ export class BaseStrategy {
14
20
  this.statelogClient = config.statelog
15
21
  ? getStatelogClient(config.statelog)
16
22
  : undefined;
23
+ this.statelogClient?.debug("Starting strategy (sync)", {
24
+ strategy: this.toString(),
25
+ });
17
26
  return this._textSync({ ...config, strategy: undefined });
18
27
  }
19
28
  async textStream(config) {
@@ -54,9 +54,18 @@ export class FallbackStrategy extends BaseStrategy {
54
54
  });
55
55
  continue;
56
56
  }
57
+ this.statelogClient?.debug("FallbackStrategy error", {
58
+ failedStrategy: strategy.toString(),
59
+ strategyIndex: i,
60
+ strategies: this.strategies.map((s) => s.toString()),
61
+ error: error.message,
62
+ });
57
63
  throw error;
58
64
  }
59
65
  }
66
+ this.statelogClient?.debug("All strategies in FallbackStrategy failed", {
67
+ strategies: this.strategies.map((s) => s.toString()),
68
+ });
60
69
  throw new Error(`All fallback strategies failed.`);
61
70
  }
62
71
  toJSON() {
package/dist/types.d.ts CHANGED
@@ -71,6 +71,7 @@ export type SmolConfig = {
71
71
  statelog?: Partial<{
72
72
  host: string;
73
73
  projectId: string;
74
+ traceId: string;
74
75
  debugMode: boolean;
75
76
  apiKey: string;
76
77
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smoltalk",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "description": "A common interface for LLM APIs",
5
5
  "homepage": "https://github.com/egonSchiele/smoltalk",
6
6
  "scripts": {