mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import { expect } from "bun:test"
|
|
import { Effect } from "effect"
|
|
import { ai, Message } from "../../src/effect.js"
|
|
import { OpenAI } from "../../src/providers.js"
|
|
import { OpenResponses } from "../../src/protocols/open-responses.js"
|
|
import { it } from "../lib/effect.js"
|
|
|
|
it.effect("conversation lowering excludes generation settings and tool definitions", () =>
|
|
Effect.gen(function* () {
|
|
const body = yield* OpenResponses.lowerConversation(
|
|
ai.request({
|
|
model: OpenAI.configure({ apiKey: "test" }).responses("fixture"),
|
|
system: "Keep the context",
|
|
messages: [Message.user("hello"), Message.assistant("hi")],
|
|
maxTokens: 100,
|
|
temperature: 0.5,
|
|
providerOptions: { store: false },
|
|
tools: [{ name: "unsupported", description: "Generation only", inputSchema: {}, native: { unsupported: {} } }],
|
|
}),
|
|
{ id: "open-responses", name: "Open Responses" },
|
|
)
|
|
expect(body).toEqual({
|
|
model: "fixture",
|
|
input: [
|
|
{ type: "message", role: "developer", content: "Keep the context" },
|
|
{ type: "message", role: "user", content: [{ type: "input_text", text: "hello" }] },
|
|
{ type: "message", role: "assistant", status: "completed", content: [{ type: "output_text", text: "hi" }] },
|
|
],
|
|
})
|
|
}),
|
|
)
|