The next generation language for human and AI.
AIScript is a unique combination of interpreter programming language and web framework, both written in Rust, designed to help developers build AI applications effortlessly. The language syntax draws inspiration from Python, JavaScript, and Rust, combining their strengths to create something that's intuitive, powerful, and easy to use.
[!WARNING]
AIScript
is in early development. Please do not use it in production yet.
As a programming language, AIScript is built with a custom interpreter from the ground up:
AIScript isn't just a language—it's a complete web development solution:
std.db.pg
and std.db.redis
)$ export OPENAI_API_KEY=<your-openai-api-key> $ cat web.ai get / { """A api to ask LLM""" query { """the question to ask""" @string(min_len=3, max_len=100) // validate params with builtin directive @string question: str } // `ai` and `prompt` are keywords ai fn ask(question: str) -> str { let answer = prompt question; return answer; } // use query.name or query["name"] to access query parameter let answer = ask(query.question); return { answer }; } $ aiscript serve web.ai Listening on http://localhost:8080 $ curl http://localhost:8080 { "error": "Missing required field: question" } $ curl http://localhost:8080?question=Hi { "error": "Field validation failed: question: String length is less than the minimum length of 3" } $ curl http://localhost:8080?question=What is the capital of France? { "answer": "The capital of France is Paris." }
You can open http://localhost:8080/redoc to see the automatically generated API documentation.