DSPy ምስ Shannon ተጠቐም
dspy.LM ምስ ቀዳምነት openai/ ከምኡውን api_base Shannon ኣቐምጥ፤ modules ከም Predict ከምኡውን ReAct ድሕሪኡ ኣብ ሞዴላት Shannon ይሰርሑ።
- ዝተፈተነ 7 ሕዳ 2026
- OpenAI Chat Completions
- ኣስታት 2 ደቒቕ
ብዛዕባ DSPy
DSPy ንመደባት ሞዴል-ቋንቋ ካብ modules ከምኡውን signatures ክንዲ ብኢድ ዝተጻሕፉ prompts ዝሃንጽ ማዕቀፍ Python እዩ፣ ምስ optimizers ዘስተኻኽልዎም። ሞዴላት ብLiteLLM ይጽውዕ፣ ስለዚ ዝኾነ endpoint ምስ OpenAI ዝሰማማዕ ይሰርሕ፣ Shannon ጨምሮ።
እንታይ የድልየካ
- ናይ Shannon API ቁልፊ
- ቁልፍታትን ኣጠቓቕማን
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - ኩሎም ኣብ ታሕቲ ዘለዉ ቁራጻት ኮድ ምርጫኻ ይስዕቡ።
ኣዳልዎ
-
DSPy ኣጽንብር
Shellpip install dspy -
ሞዴል ኣዳሉ
ቀዳምነት
openai/መንገዲ ምስ OpenAI ዝሰማማዕ ይመርጽ፤api_baseናብ Shannon የመልክቶ።Pythonimport dspy lm = dspy.LM("openai/Kimi-K3-uncensored-NVFP4", api_base="https://api.shannon-ai.com/v1", api_key="YOUR_API_KEY") dspy.configure(lm=lm) print(lm("Name three colours a cat can be.")[0]) -
Module ምስ tool ተጠቐም
Pythondef get_weather(city: str) -> str: """Weather for a city.""" return f"Sunny, 18 C in {city}" react = dspy.ReAct("question -> answer", tools=[get_weather], max_iters=3) print(react(question="What is the weather in Oslo?").answer)
ከም ዝሰርሕ ኣረጋግጽ
ልኣኽ: ቀዳማይ ናሙና ኣሰርሕ።
ክትርኢ ዘለካ: ሓንቲ ሓሳብ ምስ ሰለስተ ሕብርታት ድመት።
ምስ DSPy ዝሰማምዑ ሞዴላት
ነፍሲ ወከፍ ኣብ ታሕቲ ዘሎ id ነቲ DSPy ዘድልዮ የማልእ። እቲ ቀዳማይ ኣብ ቁራጻት ኮድ ነባሪ እዩ።
| ሞዴል id | context መስኮት | ዝለዓለ 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 | ኣይፋል |
ክትፈልጦ ዘለካ
- DSPy ብቀዳማይ ኣገባብ መልስታት ኣብ disk ይዕቅብ፤ ኣብ ግዜ ፈተና ነፍሲ ወከፍ ጸዋዒት ናብ ሞዴል ክበጽሕ
cache=Falseናብdspy.LMኣሕልፍ። ReActንነፍሲ ወከፍ ስጉምቲ ሓደ ሕቶ ከምኡውን ሓደ መልሲ ንምውጻእ የምጽእ፣ ስለዚ ሓጻር ስራሕ tool ብዙሓት ሕቶታት ይወስድ።- Optimizers ከም MIPROv2 ብዙሓት ሕቶታት ይልእኹ፤ ኣብ ሞዴል ብtokens ዝቑጸር ፈትኖም እምበር ምስ ናይ ጸዋዒት ድልየት ኣይኮነን።
ምኽርታት
dspy.inspect_history(n=1)ናይ መወዳእታ prompt ከምኡውን መልሲ የሕትም፣ module ክፉእ ክገብር ከሎ ይሕግዝ።- ንነፍሲ ወከፍ module ዝተፈለየ
dspy.LMብmodule.set_lm(...)ኣቐምጥ ሞዴላት Shannon ንምሕዋስ። max_tokensኣብdspy.LMንውሓት መልሲ ይገድብ።
ጸገማት ምፍታሕ
| ምልክት | ምክንያት | ፍታሕ |
|---|---|---|
LLM Provider NOT provided | እቲ id ሞዴል ቀዳምነት openai/ ይጎድሎ። | ከም openai/<id> ጸሓፎ። |
| ኩሉ ግዜ ተመሳሳሊ መልሲ | Cache ናይ DSPy። | cache=False ኣሕልፍ ወይ እቲ መእተዊ ቀይር። |
401 Unauthorized | እቲ ቁልፊ የለን፣ ብጌጋ ተጻሒፉ ወይ ተቐይሩ። | ቁልፊ ካብ ቁልፍታትን ኣጠቓቕማን ደጊምካ ቀዲሕ፤ ብ sk- ይጅምር። |
context_length_exceeded ወይ "prompt is too long" ዝብል መልእኽቲ | እቲ ዘተ ካብ context window ናይቲ ሞዴል ይነውሕ። | ሓድሽ chat ጀምር፣ ነቲ መሳለጥያ ከጥርኖ ፍቐደሉ፣ ወይ ዝዓበየ window ዘለዎ ሞዴል ምረጽ። |
insufficient_quota | ሚዛንካ ነዚ ጠለብ ንምኽፋል ኣይኣክልን። | credit ምላእ ወይ ፕላን ቀይር፤ እቲ ጠለብ ባዕሉ ደጊሙ ኣይፍተንን። |
ሕቶታት
DSPy ምስ Shannon ይሰርሕዶ?
እወ፣ ብdspy.LM("openai/<id>", api_base="https://api.shannon-ai.com/v1")።
Tools ReAct ይሰርሑዶ?
እወ፤ module ReAct ሓደ tool ዝጸወዐን ዝመለሰን ኣሰሪሕናዮ።