Sebelisa AutoGen le Shannon
Supa OpenAIChatCompletionClient ea AutoGen ho Shannon 'me u hlalose model ka model_info; li-agent le li-tool li sebetsa ho li-model tsa Shannon.
- E lekiloe 2026 Pun 7
- OpenAI Chat Completions
- Metsotso e ka bang 2
Mabapi le AutoGen
AutoGen ke moralo o bulehileng oa mohloli oa Microsoft oa li-agent tse buisanang le tse ling le le li-tool. AgentChat, lera la eona la maemo a holimo, le haha bathusi le lihlopha holim'a model client. OpenAI client e amohela base URL le tlhaloso ea model, kahoo li-agent tsa AutoGen li ka sebetsa ho li-model tsa Shannon.
Seo u se hlokang
- Senotlolo sa API sa Shannon
- Linotlolo le tšebeliso
- Base URL
-
https://api.shannon-ai.com/v1Endpoint:/v1/chat/completions - Snippet e 'ngoe le e 'ngoe e ka tlase e latela khetho ea hau.
E hlophise
-
Kenya AgentChat le OpenAI extension
Shellpip install autogen-agentchat 'autogen-ext[openai]' -
Theha client
AutoGen e tseba feela mabitso a li-model tsa OpenAI. Bakeng sa id efe kapa efe e 'ngoe,
model_infoe e bolella seo model e ka se etsang; ntle le eona, client e hlahisa phoso.Pythonfrom autogen_ext.models.openai import OpenAIChatCompletionClient client = OpenAIChatCompletionClient( model="Kimi-K3-uncensored-NVFP4", base_url="https://api.shannon-ai.com/v1", api_key="YOUR_API_KEY", model_info={ "vision": True, "function_calling": True, "json_output": True, "structured_output": True, "family": "unknown", }, ) -
Tsamaisa agent e nang le tool
Pythonimport asyncio from autogen_agentchat.agents import AssistantAgent async def get_weather(city: str) -> str: """Weather for a city.""" return f"Sunny, 18 C in {city}" async def main(): agent = AssistantAgent("assistant", model_client=client, tools=[get_weather]) result = await agent.run(task="What is the weather in Oslo?") print(result.messages[-1].content) await client.close() asyncio.run(main())
Hlahloba hore e a sebetsa
Romela: Tsamaisa sampole ea agent.
U lokela ho bona: Tool call ho get_weather, ebe sephetho sa eona e le molaetsa oa ho qetela.
Li-model tse loketseng AutoGen
Id e 'ngoe le e 'ngoe e ka tlase e khotsofatsa seo AutoGen e se hlokang. Ea pele ke default ho li-snippet.
| Id ea model | Fensetere ea context | Tsoa e kholo ka ho fetisisa | Kenyo ea setšoantšo |
|---|---|---|---|
Kimi-K3-uncensored-NVFP4 | 1,022,976 | 262,144 | E |
Kimi-K3-uncensored-3BIT-REAP | 225,280 | 225,280 | E |
shannon-3 | 196,608 | 65,536 | E |
shannon-coder-1 | 131,072 | 65,536 | Che |
Ho molemo ho tseba
model_infoe a hlokahala bakeng sa id e 'ngoe le e 'ngoe eo AutoGen e sa e tsebeng, ho kenyeletsoa li-id tsohle tsa Shannon.create_streame fetisa reasoning ea model e le mongolo o phuthetsoeng ka li-tag tsa<think>pele ho karabo; e tlose haeba u bontša stream ho basebelisi.- Ka mokhoa oa default
AssistantAgente khutlisa sephetho sa tool e le molaetsa oa ho qetela; setareflect_on_tool_use=Truehore model e ngole karabo ho tsoa ho sona, e jang kopo e le 'ngoe e eketsehileng.
Malebela
client.create_stream([...])e etsa stream ea li-chunk tsa mongolo bakeng sa kopo e le 'ngoe.- Seta
"vision": Truefeela bakeng sa li-model tse amohelang litšoantšo, tse kangKimi-K3-uncensored-NVFP4. - Client e le 'ngoe e ka sebeletsa li-agent tse ngata sehlopheng; e koale ka
await client.close()qetellong.
Ho rarolla mathata
| Matšoao | Lebaka | Tokiso |
|---|---|---|
ValueError: model_info is required when model name is not a valid OpenAI model | Id ea model hase e 'ngoe ea tse tsebahalang ke AutoGen. | Fetisa model_info joalo ka ka holimo. |
404 Not Found | base_url ha e na /v1. | Sebelisa https://api.shannon-ai.com/v1. |
401 Unauthorized | Senotlolo ha se eo, se ngotsoe hampe kapa se fetotsoe. | Kopitsa senotlolo hape ho tsoa ho Keys & usage; se qala ka sk-. |
context_length_exceeded / “prompt is too long” | Puisano e telele ho feta window ea model. | Qala chat e ncha, tlohela tool e e compact, kapa khetha model e nang le window e kholoanyane. |
insufficient_quota | Balance ea hau e ke ke ea lefella kopo. | Eketsa credit kapa fetola plan; kopo ha e lekoe hape ka boeona. |
Lipotso
Na AutoGen e sebetsa le Shannon?
E, ka OpenAIChatCompletionClient e nang le base_url="https://api.shannon-ai.com/v1" le block ea model_info.
Na li-tool tsa AutoGen lia sebetsa?
E; ka function_calling: True agent e fumana tool calls tsa tlhaho, tseo re li lekileng.