diff --git a/demos/README.md b/demos/README.md index 6e467a33..31305b3b 100644 --- a/demos/README.md +++ b/demos/README.md @@ -37,6 +37,7 @@ This directory contains demos showcasing Plano's capabilities as an AI-native pr | Demo | Description | |------|-------------| | [Ollama](integrations/ollama/) | Use Ollama as a local LLM provider through Plano | +| [Xiaomi MiMo](integrations/xiaomi_mimo/) | Route OpenAI-compatible MiMo API calls through Plano as a model provider | | [Spotify Bearer Auth](integrations/spotify_bearer_auth/) | Bearer token authentication for third-party APIs (Spotify new releases and top tracks) | ## Advanced diff --git a/demos/integrations/xiaomi_mimo/README.md b/demos/integrations/xiaomi_mimo/README.md new file mode 100644 index 00000000..d00b0565 --- /dev/null +++ b/demos/integrations/xiaomi_mimo/README.md @@ -0,0 +1,68 @@ +# Xiaomi MiMo via Plano + +This demo configures Plano to call Xiaomi MiMo as a standard LLM upstream using the OpenAI-compatible API surface. + +## Prerequisites + +1. Ensure the [prerequisites](https://github.com/katanemo/arch/?tab=readme-ov-file#prerequisites) are installed correctly. +2. Export your MiMo API key: + +```sh +export MIMO_API_KEY=your_mimo_api_key +``` + +## Start the demo + +```sh +sh run_demo.sh +``` + +Plano will start a model listener on `http://localhost:12000`. + +## First API call through Plano + +```sh +curl --location --request POST 'http://localhost:12000/v1/chat/completions' \ + --header "Content-Type: application/json" \ + --data-raw '{ + "model": "mimo-v2-pro", + "messages": [ + { + "role": "system", + "content": "You are MiMo, an AI assistant developed by Xiaomi. Today is Tuesday, December 16, 2025. Your knowledge cutoff date is December 2024." + }, + { + "role": "user", + "content": "please introduce yourself" + } + ], + "max_completion_tokens": 1024, + "temperature": 1.0, + "top_p": 0.95, + "stream": false + }' +``` + +## Optional: OpenAI Python SDK against Plano + +```python +from openai import OpenAI + +client = OpenAI( + api_key="unused-when-calling-plano", + base_url="http://localhost:12000/v1", +) + +resp = client.chat.completions.create( + model="mimo-v2-pro", + messages=[{"role": "user", "content": "please introduce yourself"}], +) + +print(resp.model_dump_json(indent=2)) +``` + +## Stop the demo + +```sh +sh run_demo.sh down +``` diff --git a/demos/integrations/xiaomi_mimo/config.yaml b/demos/integrations/xiaomi_mimo/config.yaml new file mode 100644 index 00000000..ea36519c --- /dev/null +++ b/demos/integrations/xiaomi_mimo/config.yaml @@ -0,0 +1,19 @@ +version: v0.3.0 + +listeners: + - type: model + name: mimo_model_listener + address: 0.0.0.0 + port: 12000 + max_retries: 3 + +model_providers: + - model: xiaomi/mimo-v2-pro + access_key: $MIMO_API_KEY + default: true + +system_prompt: | + You are MiMo, an AI assistant developed by Xiaomi. + +tracing: + random_sampling: 100 diff --git a/demos/integrations/xiaomi_mimo/run_demo.sh b/demos/integrations/xiaomi_mimo/run_demo.sh new file mode 100644 index 00000000..2b8df748 --- /dev/null +++ b/demos/integrations/xiaomi_mimo/run_demo.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +start_demo() { + if [ -f ".env" ]; then + echo ".env file already exists. Skipping creation." + else + if [ -z "$MIMO_API_KEY" ]; then + echo "Error: MIMO_API_KEY environment variable is not set for the demo." + exit 1 + fi + + echo "Creating .env file..." + echo "MIMO_API_KEY=$MIMO_API_KEY" > .env + echo ".env file created with MIMO_API_KEY." + fi + + echo "Starting Plano with config.yaml..." + planoai up config.yaml +} + +stop_demo() { + echo "Stopping Plano..." + planoai down +} + +if [ "$1" == "down" ]; then + stop_demo +else + start_demo +fi