Agent manokana sy mahaleo tena
Ampiasao amin'i Shannon ny smolagents
Ampifandraiso amin'i Shannon ny OpenAIServerModel an'i smolagents ary alefaso ny ToolCallingAgent na CodeAgent amin'ny model Shannon.
- Notsapaina tamin'ny 7 Nov 2026
- OpenAI Chat Completions
- Manodidina ny 2 min
Momba ny smolagents
smolagents dia library agent minimal an'i Hugging Face. Ny CodeAgent dia manoratra Python hanaovana hetsika, ary ny ToolCallingAgent kosa mampiasa tool calls native. Ny model dia miditra amin'ny wrapper kely, ary ilay mifanaraka amin'ny OpenAI dia mandray base URL, ka samy afaka mandeha amin'ny model Shannon ny karazana agent roa.
Izay ilainao
- API key Shannon
- Fanalahidy sy fampiasana
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - Manaraka ny safidinao ny ohatra rehetra etsy ambany.
Fametrahana
-
Apetraho i smolagents miaraka amin'ny extra OpenAI
Shellpip install 'smolagents[openai]' -
Forony ny model sy 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?"))
Hamarino fa miasa
Alefaso: Alefaso ny ohatra.
Tokony ho hitanao: Miantso ny get_weather ny agent, dia final_answer, ary manonta ny toetr'andro any Oslo.
Model mifanaraka amin'ny smolagents
Mahafeno izay ilain'ny smolagents ny id rehetra etsy ambany. Ny voalohany no default ao amin'ny ohatra kaody.
| Id model | Context window | Output farany | Sary ho fidirana |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | Eny |
Kimi-K3.1-Pro-uncensored-NVFP4 | 1,022,976 | 262,144 | Eny |
MiMo-V2.6-Pro-uncensored-NVFP4 | 1,022,976 | 131,072 | Eny |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | Eny |
shannon-3 | 196,608 | 65,536 | Eny |
Tsara ho fantatra
- smolagents dia mamaky ny docstring an'ny tool tsirairay: ilaina ny fizarana
Args:miaraka amin'ny andalana isaky ny argument, fa raha tsy izany dia manao hadisoana ny@tool. - Ny dingana tsirairay dia fangatahana iray. Ny
max_stepsdia mamerana ny isan'ny azon'ny agent alaina. - Ny
CodeAgentdia mampandeha Python nosoratan'ny model amin'ny milinao; ampiasao ny safidy sandbox-ny ho an'ny asa tsy azo itokisana. - Ny version vao haingana dia manao hoe
OpenAIModelny kilasy; mbola mandeha nyOpenAIServerModelary izany no nampiasainay.
Toro-hevitra
- Ny
ToolCallingAgentdia mampiasa tool calls native; nyCodeAgentkosa mampiasa lahatsoratra tsotra ary mandeha amin'ny model rehetra. - Ny
agent.run(..., stream=True)dia manome ny dingana tsirairay rehefa mitranga. - Ny fiantsoana mivantana ny model amin'ny
model.generate([...])dia fitsapana fifandraisana haingana. - Ny dingana tsirairay dia manonta ny input sy output token-ny; ny asa toetr'andro roa dingana nataonay dia nampiasa input token manodidina ny 20,000 tamin'ny
shannon-coder-1.
Famahana olana
| Soritr'aretina | Antony | Vahaolana |
|---|---|---|
404 Not Found | Tsy ao amin'ny api_base ny /v1. | Ampiasao ny https://api.shannon-ai.com/v1. |
| "Reached max steps" | Mila dingana maro noho ny max_steps ny asa. | Ampitomboy ny max_steps na ataovy tsotra ny asa. |
401 Unauthorized | Tsy ao ny key, diso soratra, na efa novaina. | Adikao indray ny key avy ao amin'ny Keys & usage; manomboka amin'ny sk- izy. |
context_length_exceeded na "prompt is too long" | Lava noho ny context window an'ny model ny resaka. | Manombohy chat vaovao, avelao ny fitaovana hanafohy azy, na misafidiana model manana window lehibe kokoa. |
insufficient_quota | Tsy ampy handoavana ny fangatahana ny balance-nao. | Ampio ny balance na ovay ny plan; tsy averina ho azy ny fangatahana. |
Fanontaniana
Mandeha ve i smolagents miaraka amin'i Shannon?
Eny, amin'ny alalan'ny OpenAIServerModel(api_base="https://api.shannon-ai.com/v1").
Karazana agent iza no tokony hampiasaiko?
ToolCallingAgent miaraka amin'ny model avy ao amin'ny picker, satria samy manao tool calls native izy rehetra; izany no nolazainay.