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


Quelle  moonshot.live.test.ts

  Sprache: JAVA
 

import { completeSimple, type Model } from "@mariozechner/pi-ai";
import { describe, expect, it } from "vitest";
import {
  createSingleUserPromptMessage,
  extractNonEmptyAssistantText,
  isLiveTestEnabled,
} from "./live-test-helpers.js";

const MOONSHOT_KEY = process.env.MOONSHOT_API_KEY ?? "";
const MOONSHOT_BASE_URL = process.env.MOONSHOT_BASE_URL?.trim() || "https://api.moonshot.ai/v1";
const MOONSHOT_MODEL = process.env.MOONSHOT_MODEL?.trim() || "kimi-k2.5";
const LIVE = isLiveTestEnabled(["MOONSHOT_LIVE_TEST"]);

const describeLive = LIVE && MOONSHOT_KEY ? describe : describe.skip;

function forceMoonshotInstantMode(payload: unknown): void {
  if (!payload || typeof payload !== "object") {
    return;
  }
  // Moonshot's official API exposes instant mode via thinking.type=disabled.
  // Without this, tiny smoke probes can spend the full token budget in hidden
  // reasoning_content and never emit visible assistant text.
  (payload as Record<string, unknown>).thinking = { type: "disabled" };
}

describeLive("moonshot live", () => {
  it("returns assistant text", async () => {
    const model: Model<"openai-completions"> = {
      id: MOONSHOT_MODEL,
      name: `Moonshot ${MOONSHOT_MODEL}`,
      api: "openai-completions",
      provider: "moonshot",
      baseUrl: MOONSHOT_BASE_URL,
      reasoning: false,
      input: ["text""image"],
      cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
      contextWindow: 256000,
      maxTokens: 8192,
    };

    const res = await completeSimple(
      model,
      {
        messages: createSingleUserPromptMessage(),
      },
      {
        apiKey: MOONSHOT_KEY,
        maxTokens: 64,
        onPayload: (payload) => {
          forceMoonshotInstantMode(payload);
        },
      },
    );

    const text = extractNonEmptyAssistantText(res.content);
    expect(text.length).toBeGreaterThan(0);
  }, 30000);
});

Messung V0.5 in Prozent
C=98 H=96 G=96

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge