@core-ai/core-ai 0.6.1 → 0.7.0
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/index.d.ts +7 -1
- package/dist/index.js +10 -2
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -315,6 +315,12 @@ declare class StructuredOutputValidationError extends StructuredOutputError {
|
|
|
315
315
|
|
|
316
316
|
declare function defineTool(options: ToolDefinition): ToolDefinition;
|
|
317
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Convert a Zod schema to a JSON Schema object using Zod 4's native
|
|
320
|
+
* `z.toJSONSchema()`.
|
|
321
|
+
*/
|
|
322
|
+
declare function zodSchemaToJsonSchema(schema: z.ZodType): Record<string, unknown>;
|
|
323
|
+
|
|
318
324
|
type ResultToMessageOptions = {
|
|
319
325
|
includeReasoning?: boolean;
|
|
320
326
|
};
|
|
@@ -360,4 +366,4 @@ type GenerateImageParams = ImageGenerateOptions & {
|
|
|
360
366
|
};
|
|
361
367
|
declare function generateImage(params: GenerateImageParams): Promise<ImageGenerateResult>;
|
|
362
368
|
|
|
363
|
-
export { type AssistantContentPart, type AssistantMessage, type AssistantTextPart, type BaseGenerateOptions, type ChatInputTokenDetails, type ChatModel, type ChatOutputTokenDetails, type ChatStream, type ChatUsage, type EmbedOptions, type EmbedProviderOptions, type EmbedResult, type EmbeddingModel, type EmbeddingUsage, type FilePart, type FinishReason, type GenerateObjectOptions, type GenerateObjectResult, type GenerateOptions, type GenerateProviderOptions, type GenerateResult, type GeneratedImage, type ImageGenerateOptions, type ImageGenerateResult, type ImageModel, type ImagePart, type ImageProviderOptions, LLMError, type Message, type ObjectStream, type ObjectStreamEvent, ProviderError, type ReasoningConfig, type ReasoningEffort, type ReasoningPart, StreamAbortedError, type StreamEvent, type StreamObjectOptions, StructuredOutputError, StructuredOutputNoObjectGeneratedError, StructuredOutputParseError, StructuredOutputValidationError, type SystemMessage, type TextPart, type ToolCall, type ToolCallPart, type ToolChoice, type ToolDefinition, type ToolResultMessage, type ToolSet, type UserContentPart, type UserMessage, assistantMessage, createChatStream, createObjectStream, defineTool, embed, generate, generateImage, generateObject, getProviderMetadata, resultToMessage, stream, streamObject };
|
|
369
|
+
export { type AssistantContentPart, type AssistantMessage, type AssistantTextPart, type BaseGenerateOptions, type ChatInputTokenDetails, type ChatModel, type ChatOutputTokenDetails, type ChatStream, type ChatUsage, type EmbedOptions, type EmbedProviderOptions, type EmbedResult, type EmbeddingModel, type EmbeddingUsage, type FilePart, type FinishReason, type GenerateObjectOptions, type GenerateObjectResult, type GenerateOptions, type GenerateProviderOptions, type GenerateResult, type GeneratedImage, type ImageGenerateOptions, type ImageGenerateResult, type ImageModel, type ImagePart, type ImageProviderOptions, LLMError, type Message, type ObjectStream, type ObjectStreamEvent, ProviderError, type ReasoningConfig, type ReasoningEffort, type ReasoningPart, StreamAbortedError, type StreamEvent, type StreamObjectOptions, StructuredOutputError, StructuredOutputNoObjectGeneratedError, StructuredOutputParseError, StructuredOutputValidationError, type SystemMessage, type TextPart, type ToolCall, type ToolCallPart, type ToolChoice, type ToolDefinition, type ToolResultMessage, type ToolSet, type UserContentPart, type UserMessage, assistantMessage, createChatStream, createObjectStream, defineTool, embed, generate, generateImage, generateObject, getProviderMetadata, resultToMessage, stream, streamObject, zodSchemaToJsonSchema };
|
package/dist/index.js
CHANGED
|
@@ -53,11 +53,18 @@ var StructuredOutputValidationError = class extends StructuredOutputError {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
// src/tool.ts
|
|
56
|
-
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
57
56
|
function defineTool(options) {
|
|
58
57
|
return options;
|
|
59
58
|
}
|
|
60
59
|
|
|
60
|
+
// src/json-schema.ts
|
|
61
|
+
import { z } from "zod";
|
|
62
|
+
function zodSchemaToJsonSchema(schema) {
|
|
63
|
+
return z.toJSONSchema(schema, {
|
|
64
|
+
io: "input"
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
// src/result-to-message.ts
|
|
62
69
|
function resultToMessage(result, options) {
|
|
63
70
|
const includeReasoning = options?.includeReasoning ?? true;
|
|
@@ -509,5 +516,6 @@ export {
|
|
|
509
516
|
getProviderMetadata,
|
|
510
517
|
resultToMessage,
|
|
511
518
|
stream,
|
|
512
|
-
streamObject
|
|
519
|
+
streamObject,
|
|
520
|
+
zodSchemaToJsonSchema
|
|
513
521
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@core-ai/core-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Type-safe LLM abstraction layer over native provider SDKs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Omnifact (https://omnifact.ai)",
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
"test:watch": "vitest"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"zod": "^
|
|
47
|
-
"zod-to-json-schema": "^3.25.1"
|
|
46
|
+
"zod": "^4.0.0"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
49
|
"@core-ai/eslint-config": "*",
|