smolagents ምስ Shannon ተጠቐም
OpenAIServerModel ናይ smolagents ናብ Shannon ኣመልክት ከምኡውን ToolCallingAgent ወይ CodeAgent ኣብ ሞዴላት Shannon ኣሂዝ።
- ዝተፈተነ 7 ሕዳ 2026
- OpenAI Chat Completions
- ኣስታት 2 ደቒቕ
ብዛዕባ smolagents
smolagents ናይ Hugging Face ንእሽቶ agent library እዩ። CodeAgent ንምስራሕ Python ይጽሕፍ፣ ToolCallingAgent ድማ ጥዑይ tool calls ይጥቀም። ሞዴላት ብንኣሽቱ wrappers ይኣትዉ፣ እቲ OpenAI-compatible ድማ base URL ይቕበል፣ ስለዚ ክልቲኡ ዓይነት agent ኣብ ሞዴላት Shannon ክሰርሑ ይኽእሉ።
እንታይ የድልየካ
- ናይ Shannon API ቁልፊ
- ቁልፍታትን ኣጠቓቕማን
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - ኩሎም ኣብ ታሕቲ ዘለዉ ቁራጻት ኮድ ምርጫኻ ይስዕቡ።
ኣዳልዎ
-
smolagents ምስ ተወሳኺ OpenAI ጸዓን
Shellpip install 'smolagents[openai]' -
ሞዴል ከምኡውን agent ፍጠር
Pythonfrom smolagents import OpenAIServerModel, ToolCallingAgent, tool model = OpenAIServerModel( model_id="Kimi-K3-uncensored-NVFP4", api_base="https://api.shannon-ai.com/v1", api_key="YOUR_API_KEY", ) @tool def get_weather(city: str) -> str: """Weather for a city. Args: city: The city name. """ return f"Sunny, 18 C in {city}" agent = ToolCallingAgent(tools=[get_weather], model=model, max_steps=4) print(agent.run("What is the weather in Oslo?"))
ከም ዝሰርሕ ኣረጋግጽ
ልኣኽ: ነቲ ኣብነት ኣሂዞ።
ክትርኢ ዘለካ: እቲ agent get_weather ይጽውዕ፣ ድሕሪኡ final_answer፣ ከምኡውን ኩነታት ኣየር Oslo የሕትም።
ምስ smolagents ዝሰማምዑ ሞዴላት
ነፍሲ ወከፍ ኣብ ታሕቲ ዘሎ id ነቲ smolagents ዘድልዮ የማልእ። እቲ ቀዳማይ ኣብ ቁራጻት ኮድ ነባሪ እዩ።
| ሞዴል id | context መስኮት | ዝለዓለ output | ስእሊ ኣተዋዕዎ |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | እወ |
Kimi-K3.1-Pro-uncensored-NVFP4 | 1,022,976 | 262,144 | እወ |
MiMo-V2.6-Pro-uncensored-NVFP4 | 1,022,976 | 131,072 | እወ |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | እወ |
shannon-3 | 196,608 | 65,536 | እወ |
ክትፈልጦ ዘለካ
- smolagents docstring ናይ ነፍሲ ወከፍ tool የንብብ፦ ክፍሊ
Args:ምስ ሓደ መስመር ንነፍሲ ወከፍ argument የድሊ፣ ዘይኮነ@toolጌጋ የልዕል። - ነፍሲ ወከፍ ስጉምቲ ሓደ ጠለብ እዩ።
max_stepsሓደ agent ክወስዶ ዝኽእል ብዝሒ ይገድብ። CodeAgentብሞዴል ዝተጻሕፈ Python ኣብ ማሽንካ የሰርሕ፤ ንዘይእዙዛት ዕዮታት ኣማራጺታት sandbox ናቱ ተጠቐም።- ሓደስቲ ሕታማት ነቲ ክላስ
OpenAIModelይጽውዕዎ፤OpenAIServerModelገና ይሰርሕ ከምኡውን እቲ ዝተጠቐምናሉ እዩ።
ምኽርታት
ToolCallingAgentጥዑይ tool calls ይጥቀም፤CodeAgentንጹር ጽሑፍ ይጥቀም ከምኡውን ምስ ዝኾነ ሞዴል ይሰርሕ።agent.run(..., stream=True)ነፍሲ ወከፍ ስጉምቲ ከም ዝፍጸም የቕርቦ።- ንሞዴል ብቐጥታ ብ
model.generate([...])ምጽዋዕ ቅልጡፍ ፈተና ምትእስሳር እዩ። - ነፍሲ ወከፍ ስጉምቲ ኣተዋዕዎን ውጽኢትን tokens የሕትም፤ ናይ ክልተ-ስጉምቲ ዕዮ ኩነታት ኣየርና ኣብ
shannon-coder-1ዳርጋ 20,000 ኣተዋዕዎ tokens ተጠቒሙ።
ጸገማት ምፍታሕ
| ምልክት | ምክንያት | ፍታሕ |
|---|---|---|
404 Not Found | api_base /v1 ጎዲሉ። | https://api.shannon-ai.com/v1 ተጠቐም። |
| "Reached max steps" | እቲ ዕዮ ካብ max_steps ዝበዝሑ ስጉምታት የድሊ። | max_steps ኣዕቢዮ ወይ ነቲ ዕዮ ቀሊል ግበሮ። |
401 Unauthorized | እቲ ቁልፊ የለን፣ ብጌጋ ተጻሒፉ ወይ ተቐይሩ። | ቁልፊ ካብ ቁልፍታትን ኣጠቓቕማን ደጊምካ ቀዲሕ፤ ብ sk- ይጅምር። |
context_length_exceeded ወይ "prompt is too long" ዝብል መልእኽቲ | እቲ ዘተ ካብ context window ናይቲ ሞዴል ይነውሕ። | ሓድሽ chat ጀምር፣ ነቲ መሳለጥያ ከጥርኖ ፍቐደሉ፣ ወይ ዝዓበየ window ዘለዎ ሞዴል ምረጽ። |
insufficient_quota | ሚዛንካ ነዚ ጠለብ ንምኽፋል ኣይኣክልን። | credit ምላእ ወይ ፕላን ቀይር፤ እቲ ጠለብ ባዕሉ ደጊሙ ኣይፍተንን። |
ሕቶታት
smolagents ምስ Shannon ይሰርሕ ዶ?
እወ፣ ብ OpenAIServerModel(api_base="https://api.shannon-ai.com/v1")።
ኣየናይ ዓይነት agent ክጥቀም?
ToolCallingAgent ምስ ሞዴል ካብ picker፣ ኩሎም ጥዑይ tool calls ስለ ዝገብሩ፤ ንሱ ፈቲንናዮ።