All projects

Pick Action from Image

An archived open-source Rust crate published to crates.io that asks a vision-language model to pick the single best typed action from an image, context string, and action list.

Stack: Rust, Tokio, Askama, Reqwest, GPT-4V

What it is

pickactionfromimage is a small async Rust crate published on crates.io (https://crates.io/crates/pickactionfromimage) (v1.0.0). Given an image (ImagePath::File or ImagePath::Url), a natural-language context prompt, and a slice of candidate Action { id, description } entries, it renders a compile-time checked Askama prompt template and calls an AiImageChat backend (shipping with a GPT-4V adapter) to return the best matching action ID.

Model backends sit behind an [asynctrait] AiImageChat trait so you can swap in another vision model or a deterministic mock in unit tests.

What problem it solves

Early vision-language model experiments in Rust required rewriting the same prompt boilerplate, base64 image encoding, HTTP payloads, and response parsing every time a script or robot prototype needed to choose among a discrete set of actions from a camera frame.

This crate packaged the prompt contract, async trait boundary, and GPT-4V request handling into a single function call.

Current status

Archived. Published at v1.0.0 on crates.io and docs.rs as an early GPT-4V experiment. Modern multimodal APIs now support native structured outputs and tool calling directly, so this crate is kept archived for reference.