GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): text generators accept replies without finish_reason or … · Ryoku-dev/hyakki@3dbe40e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/textGeneration
    • TextGenerators.test.ts
    • textGeneratorDrivers.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/textGeneration/TextGenerators.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/textGeneration/TextGenerators.test.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ it.effect.each([
4747
kind: "openaiCompatible",
4848
path: "/v1/chat/completions",
4949
auth: ["authorization", "Bearer secret"],
50-
reply: { choices: [{ finish_reason: "stop", message: { content: '{"title":"Fix login"}' } }] },
50+
reply: { choices: [{ message: { content: '{"title":"Fix login"}' } }] },
5151
},
5252
{
5353
kind: "anthropic",
5454
path: "/v1/messages",
5555
auth: ["x-api-key", "secret"],
56-
reply: { stop_reason: "end_turn", content: [{ type: "text", text: '{"title":"Fix login"}' }] },
56+
reply: { content: [{ type: "text", text: '{"title":"Fix login"}' }] },
5757
},
5858
] as const)("$kind generates structured text with its API's request shape", (api) =>
5959
Effect.gen(function* () {
Collapse file

‎apps/server/src/textGeneration/textGeneratorDrivers.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/textGeneration/textGeneratorDrivers.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ const readModel = (entry: { readonly id: string; readonly name?: string | undefi
126126
const ChatCompletion = Schema.Struct({
127127
choices: Schema.Array(
128128
Schema.Struct({
129-
finish_reason: Schema.NullOr(Schema.String),
130-
message: Schema.Struct({ content: Schema.NullOr(Schema.String) }),
129+
finish_reason: Schema.optional(Schema.NullOr(Schema.String)),
130+
message: Schema.Struct({ content: Schema.optional(Schema.NullOr(Schema.String)) }),
131131
}),
132132
),
133133
});
@@ -172,7 +172,7 @@ const openAICompatible: TextGeneratorDriver = {
172172

173173
const ANTHROPIC_VERSION = "2023-06-01";
174174
const AnthropicMessage = Schema.Struct({
175-
stop_reason: Schema.NullOr(Schema.String),
175+
stop_reason: Schema.optional(Schema.NullOr(Schema.String)),
176176
content: Schema.Array(
177177
Schema.Struct({ type: Schema.String, text: Schema.optional(Schema.String) }),
178178
),

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.