Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

5 changes: 0 additions & 5 deletions repos/effect/.changeset/fix-cli-completions-hyphen.md

This file was deleted.

5 changes: 0 additions & 5 deletions repos/effect/.changeset/fix-cli-weak-span-dark-terminal.md

This file was deleted.

5 changes: 0 additions & 5 deletions repos/effect/.changeset/forward-parent-pointer-discard.md

This file was deleted.

11 changes: 11 additions & 0 deletions repos/effect/packages/ai/ai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @effect/ai

## 0.36.0

### Minor Changes

- [#6260](https://github.com/Effect-TS/effect/pull/6260) [`02ae8fb`](https://github.com/Effect-TS/effect/commit/02ae8fb15809a85ba6a9239ab4421845e87d7985) Thanks @IMax153! - Support `Tool.EmptyParams` as an explicit tool parameters schema.

### Patch Changes

- Updated dependencies [[`e2126bc`](https://github.com/Effect-TS/effect/commit/e2126bc14c4c902ff9f3dbe486e53190c6c87725), [`f7e836e`](https://github.com/Effect-TS/effect/commit/f7e836ea9b399784fdb3846d176ebe72bb07bfc7)]:
- effect@3.21.3

## 0.35.0

### Patch Changes
Expand Down
100 changes: 100 additions & 0 deletions repos/effect/packages/ai/ai/dtslint/Tool.tst.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import type * as Response from "@effect/ai/Response"
import * as Tool from "@effect/ai/Tool"
import { Schema } from "effect"
import { describe, expect, it } from "tstyche"

describe("Tool", () => {
it("infers struct parameters", () => {
const _Read = Tool.make("Read", {
parameters: {
filePath: Schema.String
}
})

expect<Tool.Parameters<typeof _Read>>().type.toBe<{
readonly filePath: string
}>()
expect<Tool.ParametersEncoded<typeof _Read>>().type.toBe<{
readonly filePath: string
}>()
expect<Response.ToolCallParts<{ readonly Read: typeof _Read }>>().type.toBe<
Response.ToolCallPart<"Read", { readonly filePath: string }>
>()
})

it("infers empty parameters", () => {
const _Empty = Tool.make("Empty")

expect<Tool.ParametersSchema<typeof _Empty>>().type.toBe<
typeof Tool.EmptyParams
>()
expect<Tool.Parameters<typeof _Empty>>().type.toBe<{
readonly [x: string]: never
}>()
expect<Tool.ParametersEncoded<typeof _Empty>>().type.toBe<{
readonly [x: string]: never
}>()
})

it("accepts explicit empty parameters", () => {
const _Empty = Tool.make("Empty", {
parameters: Tool.EmptyParams
})

expect<Tool.ParametersSchema<typeof _Empty>>().type.toBe<
typeof Tool.EmptyParams
>()
expect<Tool.Parameters<typeof _Empty>>().type.toBe<{
readonly [x: string]: never
}>()
})

it("infers setParameters with struct fields", () => {
const _Read = Tool.make("Read").setParameters({
filePath: Schema.String
})

expect<Tool.Parameters<typeof _Read>>().type.toBe<{
readonly filePath: string
}>()
expect<Tool.ParametersEncoded<typeof _Read>>().type.toBe<{
readonly filePath: string
}>()
expect<Response.ToolCallParts<{ readonly Read: typeof _Read }>>().type.toBe<
Response.ToolCallPart<"Read", { readonly filePath: string }>
>()
})

it("infers setParameters with a struct schema", () => {
const Parameters = Schema.Struct({
filePath: Schema.String
})
const _Read = Tool.make("Read").setParameters(Parameters)

expect<Tool.ParametersSchema<typeof _Read>>().type.toBe<typeof Parameters>()
expect<Tool.Parameters<typeof _Read>>().type.toBe<{
readonly filePath: string
}>()
expect<Tool.ParametersEncoded<typeof _Read>>().type.toBe<{
readonly filePath: string
}>()
})

it("infers setParameters with empty parameters", () => {
const _Empty = Tool.make("Empty", {
parameters: {
filePath: Schema.String
}
}).setParameters(Tool.EmptyParams)

expect<Tool.ParametersSchema<typeof _Empty>>().type.toBe<
typeof Tool.EmptyParams
>()
expect<Tool.Parameters<typeof _Empty>>().type.toBe<{
readonly [x: string]: never
}>()
expect<Tool.ParametersEncoded<typeof _Empty>>().type.toBe<{
readonly [x: string]: never
}>()
})
})
2 changes: 1 addition & 1 deletion repos/effect/packages/ai/ai/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@effect/ai",
"type": "module",
"version": "0.35.0",
"version": "0.36.0",
"license": "MIT",
"description": "Effect modules for working with AI apis",
"homepage": "https://effect.website",
Expand Down
Loading
Loading