@crewai-ts/core 0.1.5 → 0.1.6

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/agent.d.ts CHANGED
@@ -427,6 +427,7 @@ export declare class Agent {
427
427
  private callAndTrackLLM;
428
428
  private messagesWithInputFilesForClient;
429
429
  private clientSupportsMultimodal;
430
+ private clientSupportsFunctionCalling;
430
431
  private modelNameForClient;
431
432
  private applyGuardrail;
432
433
  private emitStep;
package/dist/index.cjs CHANGED
@@ -44139,8 +44139,13 @@ Result: ${output4}`, {
44139
44139
  const beforeUsage = getLLMUsageMetrics(llmClient);
44140
44140
  const model = this.modelNameForClient(llmClient);
44141
44141
  const responseModel = responseModelFromOptions(options);
44142
+ const nativeToolOptions = tools.length > 0 && this.clientSupportsFunctionCalling(llmClient) ? (() => {
44143
+ const [, availableFunctions] = setupNativeTools(tools);
44144
+ return { availableFunctions, available_functions: availableFunctions };
44145
+ })() : {};
44142
44146
  const result = await callLLM(llmClient, messagesForCall, {
44143
44147
  tools,
44148
+ ...nativeToolOptions,
44144
44149
  ...responseModel === void 0 ? {} : { responseModel },
44145
44150
  metadata: {
44146
44151
  agent: this,
@@ -44173,6 +44178,13 @@ Result: ${output4}`, {
44173
44178
  }
44174
44179
  return typeof candidate.supports_multimodal === "function" && candidate.supports_multimodal();
44175
44180
  }
44181
+ clientSupportsFunctionCalling(llmClient) {
44182
+ const candidate = llmClient;
44183
+ if (typeof candidate.supportsFunctionCalling === "function" && candidate.supportsFunctionCalling()) {
44184
+ return true;
44185
+ }
44186
+ return typeof candidate.supports_function_calling === "function" && candidate.supports_function_calling();
44187
+ }
44176
44188
  modelNameForClient(llmClient) {
44177
44189
  if (llmClient === this.llmClient && typeof this.llm === "string") {
44178
44190
  return this.llm;
package/dist/index.js CHANGED
@@ -27809,8 +27809,13 @@ Result: ${output4}`, {
27809
27809
  const beforeUsage = getLLMUsageMetrics(llmClient);
27810
27810
  const model = this.modelNameForClient(llmClient);
27811
27811
  const responseModel = responseModelFromOptions(options);
27812
+ const nativeToolOptions = tools.length > 0 && this.clientSupportsFunctionCalling(llmClient) ? (() => {
27813
+ const [, availableFunctions] = setupNativeTools(tools);
27814
+ return { availableFunctions, available_functions: availableFunctions };
27815
+ })() : {};
27812
27816
  const result = await callLLM(llmClient, messagesForCall, {
27813
27817
  tools,
27818
+ ...nativeToolOptions,
27814
27819
  ...responseModel === void 0 ? {} : { responseModel },
27815
27820
  metadata: {
27816
27821
  agent: this,
@@ -27843,6 +27848,13 @@ Result: ${output4}`, {
27843
27848
  }
27844
27849
  return typeof candidate.supports_multimodal === "function" && candidate.supports_multimodal();
27845
27850
  }
27851
+ clientSupportsFunctionCalling(llmClient) {
27852
+ const candidate = llmClient;
27853
+ if (typeof candidate.supportsFunctionCalling === "function" && candidate.supportsFunctionCalling()) {
27854
+ return true;
27855
+ }
27856
+ return typeof candidate.supports_function_calling === "function" && candidate.supports_function_calling();
27857
+ }
27846
27858
  modelNameForClient(llmClient) {
27847
27859
  if (llmClient === this.llmClient && typeof this.llm === "string") {
27848
27860
  return this.llm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewai-ts/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Unofficial TypeScript port of CrewAI (not affiliated with crewAI, Inc.).",
5
5
  "keywords": [
6
6
  "crewai",