Shannon உடன் Mastra-ஐப் பயன்படுத்துங்கள்
Mastra ஏஜென்ட்டுக்கு Shannon-இன் URL, key மற்றும் id கொண்ட மாடல் பொருளைக் கொடுங்கள்; streaming மற்றும் tools பிறகு Shannon மாடல்களில் இயங்கும்.
- 7 நவ., 2026 அன்று சோதிக்கப்பட்டது
- OpenAI Chat Completions
- சுமார் 3 நிமிடம்
Mastra பற்றி
Mastra என்பது ஏஜென்ட்கள், workflow-கள், நினைவகம் மற்றும் retrieval-க்கான TypeScript framework, உள்ளூர் dev studio உடன். ஏஜென்ட்கள் மாடலை அதன் model router மூலம் பெறுகின்றன; URL மற்றும் key கொடுத்தால் அது எந்த OpenAI இணக்கமான endpoint-ஐயும் ஏற்கும். இதனால் Mastra ஏஜென்ட்களும் workflow-களும் Shannon மாடல்களில் இயங்க முடியும்.
உங்களுக்குத் தேவையானவை
- ஒரு Shannon API key
- Keys & usage பக்கம்
- Base URL
-
https://api.shannon-ai.com/v1எண்ட்பாயிண்ட்:/v1/chat/completions - கீழே உள்ள எல்லாத் துணுக்குகளும் உங்கள் தேர்வைப் பின்பற்றும்.
அமைத்தல்
-
Mastra-வை நிறுவுங்கள்
Shellnpm install @mastra/core zod -
Shannon-ல் ஒரு ஏஜென்ட்டை உருவாக்குங்கள்
idஎன்பது<any prefix>/<Shannon id>;urlஎன்பது base URL, chat endpoint அல்ல.TypeScriptimport { 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 }, }); -
Stream மற்றும் generate
TypeScriptconst 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-க்குப் பொருந்தும் மாடல்கள்
கீழே உள்ள ஒவ்வொரு id-யும் Mastra-க்குத் தேவையானதைப் பூர்த்தி செய்கிறது. முதலாவது, குறியீட்டுத் துணுக்குகளில் இயல்புநிலை.
| மாடல் id | Context window அளவு | அதிகபட்ச வெளியீடு | பட உள்ளீடு |
|---|---|---|---|
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-ஐப் பயன்படுத்த, மாடல் பொருளில்api: "responses"ஐச் சேருங்கள்.
குறிப்புகள்
- உள்ளூர் studio-வில் (
mastra dev) ஏஜென்ட்களைக் காண, அவற்றை ஒருMastrainstance-ல் பதிவு செய்யுங்கள். - மாடலை ஏற்கும் workflow-களிலும் memory processor-களிலும் அதே மாடல் பொருள் வேலை செய்கிறது.
- key-ஐ
apiKey-ல் கொடுங்கள், எ.கா.SHANNON_API_KEY-லிருந்து; custom endpoint-க்கு Mastra தானாகப் படிக்கும் மாறி எதுவும் அதன் ஆவணங்களில் குறிப்பிடப்படவில்லை.
சிக்கல் தீர்வு
| அறிகுறி | காரணம் | தீர்வு |
|---|---|---|
404 Not Found | url-ல் /v1 இல்லை, அல்லது அது /chat/completions-இல் முடிகிறது. | https://api.shannon-ai.com/v1 ஐப் பயன்படுத்துங்கள். |
401 | apiKey காலியாக உள்ளது. | key-ஐ apiKey-ல் கொடுங்கள். |
401 Unauthorized | key இல்லை, தவறாகத் தட்டச்சு செய்யப்பட்டுள்ளது அல்லது மாற்றப்பட்டுள்ளது. | Keys & usage-லிருந்து key-ஐ மீண்டும் நகலெடுங்கள்; அது sk- என்று தொடங்கும். |
context_length_exceeded அல்லது "prompt is too long" என்ற செய்தி | உரையாடல் மாடலின் context window-வை விட நீளமானது. | புதிய அரட்டையைத் தொடங்குங்கள், கருவி அதைச் சுருக்கட்டும், அல்லது பெரிய window கொண்ட மாடலைத் தேர்ந்தெடுங்கள். |
insufficient_quota | உங்கள் இருப்பு இந்தக் கோரிக்கைக்குப் போதாது. | கிரெடிட்டை ரீசார்ஜ் செய்யுங்கள் அல்லது திட்டத்தை மாற்றுங்கள்; கோரிக்கை தானாக மீண்டும் முயற்சிக்கப்படாது. |
கேள்விகள்
Mastra Shannon-உடன் வேலை செய்யுமா?
ஆம்: url: "https://api.shannon-ai.com/v1" உடன் { id, url, apiKey } என்ற ஏஜென்ட் மாடல் Shannon-ஐ அடையும்.
Mastra tools வேலை செய்யுமா?
ஆம்; createTool tools இயல்பான tool அழைப்புகளாக அனுப்பப்படுகின்றன.