# Session 6 Sample: Models as Tools Dis sample dey show how to do small router + tool registry wey go fit choose model based on wetin user type and go call Foundry Local OpenAI-compatible endpoint. ## Files - `router.py`: e be simple registry and e dey use heuristic routing; e dey find endpoint + check if e dey work well. ## Run (cmd.exe) ```cmd cd Module08 .\.venv\Scripts\activate REM Start whatever models you plan to route to foundry model run phi-4-mini foundry model run qwen2.5-7b foundry model run deepseek-r1-7b python samples\06\router.py "Explain how local-first AI improves privacy in two sentences." ``` ## Notes - Dis router dey use simple keyword heuristics to choose between `general`, `reasoning`, and `code` tools and e dey print `/v1/models` when e start. - You fit configure am with environment variables: ```cmd set BASE_URL=http://localhost:8000 set API_KEY= REM Override models per tool set GENERAL_MODEL=phi-4-mini set REASONING_MODEL=deepseek-r1-7b set CODE_MODEL=qwen2.5-7b REM Or provide a full JSON registry set TOOL_REGISTRY={"general":{"model":"phi-4-mini"},"reasoning":{"model":"deepseek-r1-7b"},"code":{"model":"qwen2.5-7b"}} ``` ## References - Foundry Local (Learn): https://learn.microsoft.com/azure/ai-foundry/foundry-local/ - How to join am with inference SDKs: https://learn.microsoft.com/azure/ai-foundry/foundry-local/how-to/how-to-integrate-with-inference-sdks --- **Disclaimer**: Dis dokyument don use AI transleto service [Co-op Translator](https://github.com/Azure/co-op-translator) do di translation. Even as we dey try make am accurate, abeg sabi say machine translation fit get mistake or no dey 100% correct. Di original dokyument wey dey for im native language na di main source wey you go fit trust. For important information, e better make professional human transleto check am. We no go fit take blame for any misunderstanding or wrong interpretation wey fit happen because you use dis translation.