A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/dxiaoqi/aiscript below:

dxiaoqi/aiscript: 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 next generation language for human and AI.

https://aiscript.dev

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:

$ export OPENAI_API_KEY=<your-openai-api-key>

$ cat web.ai
get / {
    """An 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.

AIScript excels in these scenarios:

Check out the examples directory for more sample code.

See our roadmap for upcoming features and improvements.

We welcome contributions to AIScript! Please see our Contribution Guide for more information.

AIScript is released under the MIT License. See LICENSE for details.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4