Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  openresponses-phase.test.ts

  Sprache: JAVA
 

import { describe, expect, it } from "vitest";
import { CreateResponseBodySchema, OutputItemSchema } from "./open-responses.schema.js";
import { buildAgentPrompt } from "./openresponses-prompt.js";
import { createAssistantOutputItem } from "./openresponses-shape.js";

describe("openresponses phase support", () => {
  it("accepts assistant message phase and rejects user phase", () => {
    const assistantPhaseRequest = CreateResponseBodySchema.safeParse({
      model: "gpt-5.4",
      input: [
        {
          type: "message",
          role: "assistant",
          phase: "commentary",
          content: "Checking logs before I answer.",
        },
        {
          type: "message",
          role: "user",
          content: "What did you find?",
        },
      ],
    });
    expect(assistantPhaseRequest.success).toBe(true);

    const userPhaseRequest = CreateResponseBodySchema.safeParse({
      model: "gpt-5.4",
      input: [
        {
          type: "message",
          role: "user",
          phase: "commentary",
          content: "Hi",
        },
      ],
    });
    expect(userPhaseRequest.success).toBe(false);
  });

  it("accepts assistant output item phase metadata", () => {
    const outputItem = OutputItemSchema.safeParse({
      type: "message",
      id: "msg_123",
      role: "assistant",
      phase: "final_answer",
      content: [{ type: "output_text", text: "Done." }],
      status: "completed",
    });

    expect(outputItem.success).toBe(true);
  });

  it("shapes assistant output items with the provided phase", () => {
    expect(
      createAssistantOutputItem({
        id: "msg_commentary",
        text: "Checking logs.",
        phase: "commentary",
        status: "completed",
      }),
    ).toMatchObject({
      type: "message",
      id: "msg_commentary",
      role: "assistant",
      phase: "commentary",
      status: "completed",
    });

    expect(
      createAssistantOutputItem({
        id: "msg_final",
        text: "Root cause found.",
        phase: "final_answer",
        status: "completed",
      }),
    ).toMatchObject({
      type: "message",
      id: "msg_final",
      role: "assistant",
      phase: "final_answer",
      status: "completed",
    });
  });

  it("builds prompts from phased assistant history without dropping text", () => {
    const prompt = buildAgentPrompt([
      {
        type: "message",
        role: "assistant",
        phase: "commentary",
        content: "Checking logs before I answer.",
      },
      {
        type: "message",
        role: "user",
        content: "What did you find?",
      },
    ]);

    expect(prompt.message).toContain("Checking logs before I answer.");
    expect(prompt.message).toContain("What did you find?");
  });
});

Messung V0.5 in Prozent
C=100 H=97 G=98

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik