අන්තර්ගතයට යන්න
Mastra

Frameworks සහ SDKs

Shannon සමඟ Mastra භාවිත කරන්න

Mastra agent එකකට Shannon හි URL, key සහ id සහිත model object එකක් දෙන්න; streaming සහ tools ඉන්පසු Shannon models මත ධාවනය වේ.

  • පරීක්ෂා කළේ 2026 ඉල් 7
  • OpenAI Chat Completions
  • මිනිත්තු 3 ක් පමණ

Mastra ගැන

Mastra යනු agents, workflows, memory සහ retrieval සඳහා, local dev studio එකක් සහිත TypeScript framework එකකි. Agents model එකක් ගන්නේ එහි model router එක හරහාය, එය URL එකක් සහ key එකක් දුන් ඕනෑම OpenAI-අනුකූල endpoint එකක් පිළිගනී. එමගින් Mastra agents සහ workflows Shannon models මත ධාවනය කළ හැක.

ඔබට අවශ්‍ය දේ

Shannon API key එකක්
යතුරු සහ භාවිතය
Base URL
https://api.shannon-ai.com/v1 Endpoint: /v1/chat/completions
පහත සියලු code උදාහරණ ඔබේ තේරීම අනුගමනය කරයි.

සකසන්න

  1. Mastra ස්ථාපනය කරන්න

    Shell
    npm install @mastra/core zod
  2. Shannon මත agent එකක් සාදන්න

    id යනු <any prefix>/<Shannon id> ය; url යනු base URL එකයි, chat endpoint එක නොවේ.

    TypeScript
    import { Agent } from "@mastra/core/agent";
    import { createTool } from "@mastra/core/tools";
    import { z } from "zod";
    
    const getWeather = createTool({
      id: "get-weather",
      description: "Weather for a city",
      inputSchema: z.object({ city: z.string() }),
      execute: async ({ city }) => ({ weather: `Sunny, 18 C in ${city}` }),
    });
    
    export const agent = new Agent({
      id: "assistant",
      name: "assistant",
      instructions: "Answer briefly. Use tools for weather.",
      model: { id: "shannon/Kimi-K3-uncensored-NVFP4", url: "https://api.shannon-ai.com/v1", apiKey: process.env.SHANNON_API_KEY },
      tools: { getWeather },
    });
  3. Stream සහ generate කරන්න

    TypeScript
    const stream = await agent.stream("Name three colours a cat can be.");
    for await (const text of stream.textStream) process.stdout.write(text);
    
    const r = await agent.generate("What is the weather in Oslo?");
    console.log(r.text);

එය ක්‍රියා කරන බව පරීක්ෂා කරන්න

යවන්න: SHANNON_API_KEY සකසා නියැදිය ධාවනය කරන්න.

ඔබට පෙනිය යුත්තේ: වර්ණ stream වේ, ඉන්පසු tool එකේ කාලගුණය භාවිතා කරන පිළිතුරක්.

Mastra සඳහා ගැළපෙන model

පහත සෑම id එකක්ම Mastra ට අවශ්‍ය දේ සපුරයි. පළමු එක code උදාහරණවල පෙරනිමියයි.

Model IDසන්දර්භ කවුළුවඋපරිම outputරූප ආදානය
Kimi-K3-uncensored-NVFP4 1,022,976 262,144 ඔව්
Kimi-K3-uncensored-3BIT-REAP 225,280 225,280 ඔව්
shannon-3 196,608 65,536 ඔව්
shannon-coder-1 131,072 65,536 නැත

දැනගත යුතු දේ

  • url අවසන් වන්නේ /v1 වලින් යුත් base URL එක විය යුතුය; Mastra /chat/completions එක් කරයි.
  • Shannon හි /v1/responses ඒ වෙනුවට භාවිතා කිරීමට model object එකට api: "responses" එක් කරන්න.

ඉඟි

  1. ඒවා local studio එකේ (mastra dev) බැලීමට agents Mastra instance එකක ලියාපදිංචි කරන්න.
  2. Model එකක් ගන්නා workflows සහ memory processors වලද එම model object එකම ක්‍රියා කරයි.
  3. Key එක apiKey හි යවන්න, උදා. SHANNON_API_KEY වෙතින්; Mastra හි ලේඛන custom endpoint එකක් සඳහා එය තනිවම කියවන variable එකක් නම් නොකරයි.

ගැටලු නිරාකරණය

රෝග ලක්ෂණයහේතුවවිසඳුම
404 Not Found url හි /v1 නැත, නැතහොත් එය /chat/completions වලින් අවසන් වේ. https://api.shannon-ai.com/v1 භාවිතා කරන්න.
401 apiKey හිස්ය. Key එක apiKey හි යවන්න.
401 Unauthorized Key එක නැත, වැරදියට ටයිප් කර ඇත, නැතහොත් මාරු කර ඇත. යතුරු සහ භාවිතය වෙතින් key එක නැවත පිටපත් කරන්න; එය sk- වලින් ආරම්භ වේ.
context_length_exceeded / “prompt එක දිග වැඩියි” සංවාදය model එකේ context window එකට වඩා දිගය. නව chat එකක් අරඹන්න, මෙවලමට එය සම්පීඩනය කිරීමට ඉඩ දෙන්න, නැතහොත් විශාල context window එකක් ඇති model එකක් තෝරන්න.
insufficient_quota ඔබේ ශේෂය ඉල්ලීමේ ගාස්තුවට ප්‍රමාණවත් නොවේ. Credit එකතු කරන්න හෝ සැලසුම වෙනස් කරන්න; ඉල්ලීම ඉබේම නැවත උත්සාහ නොකෙරේ.

ප්‍රශ්න

Mastra Shannon සමග ක්‍රියා කරයිද?

ඔව්: url: "https://api.shannon-ai.com/v1" සහිත agent model { id, url, apiKey } Shannon වෙත ළඟා වේ.

Mastra tools ක්‍රියා කරයිද?

ඔව්; createTool tools native tool calls ලෙස යැවේ.

ඔබේ භාෂාව තෝරන්න

සියලු භාෂා සමානයි. ඔබ භාවිතා කිරීමට කැමති භාෂාව තෝරන්න.

යුරෝපය

මැද පෙරදිග සහ උතුරු අප්‍රිකාව

දකුණු ආසියාව

ගිනිකොන දිග ආසියාව

නැගෙනහිර ආසියාව

මධ්‍යම ආසියාව සහ කොකේසස්

අප්‍රිකාව

ඔෂේනියාව

නිර්මිත සහ සම්භාව්‍ය