English | 简体中文
This directory contains runnable client examples for the local GameAssistantToolServer HTTP APIs.
knowledge/: Knowledge service sample (insert/build/query text knowledge).memory/: Memory service sample (insert/build/search structured records with images).mmr/: MMR service sample (multimodal insert/query by text and image).vision/: Vision service sample (scene image insert/build/query).asr/: ASR service sample (query audio by raw samples, file, or OpenAI API).ocr/: OCR service sample (query text from an image, with or without boxes).bar/: BAR service sample (boss action recognition: insert/build/query).vlm/: VLM service sample (streamed text / text+image chat).requirements.txt: Python dependencies for all sample scripts.
- Start GameAssistantToolServer first (default host:
127.0.0.1:9190). - Ensure required models are prepared according to the root README.
- Use Python 3.10+ (recommended).
From this directory:
cd samples
pip install -r requirements.txtDependencies in requirements.txt:
richrequests-toolbeltpillow
Run commands from samples:
cd knowledge
python run_knowledge_sample.pyWhat it does:
- Uses
sample_texts/sample_1.txtandsample_texts/sample_2.txt. - Initializes one knowledge instance.
- Inserts text files and builds index.
- Queries twice.
- Cleans up instance.
cd memory
python run_memory_sample.pyWhat it does:
- Generates demo images under
memory/sample_images. - Initializes one memory instance.
- Inserts records with properties/tags/images.
- Builds index.
- Runs condition, text, and image search.
- Validates top-1 image result and cleans up.
cd mmr
python run_mmr_sample.pyWhat it does:
- Generates demo images under
mmr/sample_images. - Checks MMR enable state.
- Initializes one MMR instance.
- Inserts text-only, image-only, and hybrid records.
- Builds index.
- Queries by text and image.
- Lists records and cleans up.
cd vision
python run_vision_sample.pyWhat it does:
- Generates demo images under
vision/sample_images. - Initializes one vision instance and inserts scene pictures.
- Builds index.
- Queries with the same images.
- Verifies top-1 picture id matches expectation.
- Cleans up instance.
cd asr
python run_asr_sample.pyWhat it does:
- Uses the provided audio file
asr/sample_audio/demo_speech.wav. - Checks the ASR service enable state.
- Queries ASR by raw samples (JSON list decoded from the wav).
- Queries ASR by uploading the audio file.
- Queries ASR via the OpenAI-compatible
/v1/audio/transcriptionsendpoint.
cd ocr
python run_ocr_sample.pyWhat it does:
- Generates a demo image with text lines under
ocr/sample_images. - Checks the OCR service enable state.
- Queries OCR and prints the recognized text.
- Queries again with
return_boxes=Trueto show bounding boxes. - Queries a blank image to show an empty result.
cd bar
python run_bar_sample.pyWhat it does:
- Generates a demo boss action (a moving shape) under
bar/sample_frames. - Initializes one BAR instance.
- Inserts one boss action.
- Adds a point annotation to frame 0.
- Processes and builds the instance.
- Queries with a frame and prints the recognized boss action.
- Cleans up instance.
cd vlm
python run_vlm_sample.pyWhat it does:
- Generates a demo image under
vlm/sample_images. - Checks the VLM service enable state.
- Queries the VLM with text only.
- Queries with text + image.
- Queries with text + two images.
- Prints the streamed answers.
All APIs default to:
HOST = "127.0.0.1:9190"
If your server runs elsewhere, edit these files:
knowledge/knowledge_api.pymemory/memory_api.pymmr/mmr_api.pyvision/vision_api.pyasr/asr_api.pyocr/ocr_api.pybar/bar_api.pyvlm/vlm_api.py
A successful run usually shows:
- API responses with
"code": "ok" - progress output for build/query stages
- final cleanup request success
- Connection errors: confirm server is running and reachable on the configured host.
- Build/query failures: check server logs and model/config readiness.
- Missing packages: re-run
pip install -r requirements.txt. - Permission/file errors: run from the corresponding sample directory so relative paths resolve correctly.