Skip to content

Runtime API Examples

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main useData() API can be used to access site, theme, and page data for the current page. It works in both .md and .vue files:

md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

Results

Theme Data

{
  "nav": [
    {
      "text": "Home",
      "link": "/"
    },
    {
      "text": "Blog",
      "link": "/blog/"
    },
    {
      "text": "Deprecated API Docs",
      "items": [
        {
          "items": [
            {
              "text": "Full AIsBreaker API Docs ",
              "link": "/deprecated/aisbreaker-api/docs/"
            }
          ]
        },
        {
          "items": [
            {
              "text": "Intro - What is AIsBreaker API?",
              "link": "/deprecated/aisbreaker-api/docs/"
            },
            {
              "text": "Intro - Basic Concepts",
              "link": "/deprecated/aisbreaker-api/docs/concepts"
            }
          ]
        },
        {
          "items": [
            {
              "text": "Getting Started - with TypeScript/JavaScript",
              "link": "/deprecated/aisbreaker-api/docs/getting-started-with-typescript-javascript"
            },
            {
              "text": "Getting Started - with Java/Kotlin/JVM",
              "link": "/deprecated/aisbreaker-api/docs/getting-started-with-java"
            },
            {
              "text": "Getting Started - with Python",
              "link": "/deprecated/aisbreaker-api/docs/getting-started-with-python"
            },
            {
              "text": "Getting Started - with Bash Shellscript",
              "link": "/deprecated/aisbreaker-api/docs/getting-started-with-bash"
            },
            {
              "text": "Getting Started - with REST API",
              "link": "/deprecated/aisbreaker-api/docs/aisbreaker-rest-api"
            }
          ]
        },
        {
          "items": [
            {
              "text": "JavaScript Code (Intro)",
              "link": "/deprecated/aisbreaker-api/docs/demo-javascript-intro"
            },
            {
              "text": "JavaScript Code (Live Demo in StackBlitz Web-IDE)",
              "link": "https://stackblitz.com/github/aisbreaker/aisbreaker-example-simple-chat-node-js?title=AIsBreaker+Example+Simple+Chat-node-js&file=aisbreaker-simple-chat.js&startScript=install,start"
            }
          ]
        },
        {
          "items": [
            {
              "text": "REST API Access (Intro)",
              "link": "/deprecated/aisbreaker-api/docs/demo-rest-api-access-intro"
            },
            {
              "text": "REST API Access (Live Demo with Web-Curl)",
              "link": "https://reqbin.com/c-m2n6cdnu"
            }
          ]
        },
        {
          "items": [
            {
              "text": "Chat WebApp (Intro)",
              "link": "/deprecated/aisbreaker-api/docs/demo-chat-webapp-intro"
            },
            {
              "text": "Chat WebApp (Live Demo in Web)",
              "link": "https://demo.aisbreaker.org/"
            }
          ]
        },
        {
          "text": "API Reference",
          "link": "/reference/"
        }
      ]
    },
    {
      "text": "Contact",
      "link": "/contact"
    }
  ],
  "footer": {
    "message": "Released under the MIT License.",
    "copyright": "Copyright © 2023-2024 AIsBreaker"
  },
  "outline": {
    "level": "deep"
  },
  "sidebar": {
    "/docs/": {
      "base": "/docs",
      "items": [
        {
          "text": "Introduction",
          "collapsed": false,
          "items": [
            {
              "text": "What is AIsBreaker API?",
              "link": "/"
            },
            {
              "text": "API Architecture",
              "link": "/architecture"
            },
            {
              "text": "Basic Concepts",
              "link": "/concepts"
            },
            {
              "text": "Use Cases",
              "link": "/use-cases"
            }
          ]
        },
        {
          "text": "Gettings Started",
          "collapsed": false,
          "items": [
            {
              "text": "Getting Started - with TypeScript/JavaScript",
              "link": "/getting-started-with-typescript-javascript"
            },
            {
              "text": "Getting Started - with Java/Kotlin/JVM",
              "link": "/getting-started-with-java"
            },
            {
              "text": "Getting Started - with Python",
              "link": "/getting-started-with-python"
            },
            {
              "text": "Getting Started - with Bash Shellscript",
              "link": "/getting-started-with-bash"
            },
            {
              "text": "Getting Started - with REST API",
              "link": "/aisbreaker-rest-api"
            }
          ]
        },
        {
          "text": "Client Details",
          "collapsed": false,
          "items": [
            {
              "text": "Services (List)",
              "link": "/services"
            },
            {
              "text": "Tasks of AI Services",
              "link": "/tasks"
            },
            {
              "text": "Service Identification with serviceId",
              "link": "/serviceId"
            },
            {
              "text": "Service Properties / ServiceProps / AIsServiceProps",
              "link": "/service-properties"
            },
            {
              "text": "Service URL",
              "link": "/url"
            },
            {
              "text": "Request",
              "link": "/request"
            },
            {
              "text": "Response (ResponseFinal and ResponseEvent)",
              "link": "/response"
            },
            {
              "text": "Conversation State",
              "link": "/conversation-state"
            },
            {
              "text": "AIsBreaker Client API",
              "link": "/aisbreaker-client-api"
            },
            {
              "text": "AIsBreaker REST API",
              "link": "/aisbreaker-rest-api"
            },
            {
              "text": "API Keys (Access Tokens)",
              "link": "/api-keys"
            },
            {
              "text": "AIsBreaker API Key (AIsBreaker Access Token)",
              "link": "/aisbreaker-api-key"
            },
            {
              "text": "Apps using AIsBreaker / Examples",
              "link": "/examples"
            }
          ]
        },
        {
          "text": "Server Details",
          "collapsed": false,
          "items": [
            {
              "text": "AIsBreaker Server",
              "link": "/aisbreaker-server"
            }
          ]
        },
        {
          "text": "AIsBreaker Development",
          "collapsed": false,
          "items": [
            {
              "text": "AIsBreaker for JavaScript/TypeScript",
              "base": "/deprecated/aisbreaker-api/docs/aisbreaker-api-js",
              "collapsed": false,
              "items": [
                {
                  "text": "AIsBreaker Packages",
                  "link": "/aisbreaker-packages"
                },
                {
                  "text": "Monorepo",
                  "link": "/monorepo"
                },
                {
                  "text": "Development Process",
                  "link": "/development-process"
                },
                {
                  "text": "Release and Deploy new Versions",
                  "link": "/release"
                }
              ]
            },
            {
              "text": "Writing Docs",
              "link": "/writing-docs/"
            }
          ]
        }
      ]
    },
    "/deprecated/aisbreaker-api/docs/": {
      "base": "/deprecated/aisbreaker-api/docs",
      "items": [
        {
          "text": "Introduction",
          "collapsed": false,
          "items": [
            {
              "text": "What is AIsBreaker API?",
              "link": "/"
            },
            {
              "text": "API Architecture",
              "link": "/architecture"
            },
            {
              "text": "Basic Concepts",
              "link": "/concepts"
            },
            {
              "text": "Use Cases",
              "link": "/use-cases"
            }
          ]
        },
        {
          "text": "Gettings Started",
          "collapsed": false,
          "items": [
            {
              "text": "Getting Started - with TypeScript/JavaScript",
              "link": "/getting-started-with-typescript-javascript"
            },
            {
              "text": "Getting Started - with Java/Kotlin/JVM",
              "link": "/getting-started-with-java"
            },
            {
              "text": "Getting Started - with Python",
              "link": "/getting-started-with-python"
            },
            {
              "text": "Getting Started - with Bash Shellscript",
              "link": "/getting-started-with-bash"
            },
            {
              "text": "Getting Started - with REST API",
              "link": "/aisbreaker-rest-api"
            }
          ]
        },
        {
          "text": "Client Details",
          "collapsed": false,
          "items": [
            {
              "text": "Services (List)",
              "link": "/services"
            },
            {
              "text": "Tasks of AI Services",
              "link": "/tasks"
            },
            {
              "text": "Service Identification with serviceId",
              "link": "/serviceId"
            },
            {
              "text": "Service Properties / ServiceProps / AIsServiceProps",
              "link": "/service-properties"
            },
            {
              "text": "Service URL",
              "link": "/url"
            },
            {
              "text": "Request",
              "link": "/request"
            },
            {
              "text": "Response (ResponseFinal and ResponseEvent)",
              "link": "/response"
            },
            {
              "text": "Conversation State",
              "link": "/conversation-state"
            },
            {
              "text": "AIsBreaker Client API",
              "link": "/aisbreaker-client-api"
            },
            {
              "text": "AIsBreaker REST API",
              "link": "/aisbreaker-rest-api"
            },
            {
              "text": "API Keys (Access Tokens)",
              "link": "/api-keys"
            },
            {
              "text": "AIsBreaker API Key (AIsBreaker Access Token)",
              "link": "/aisbreaker-api-key"
            },
            {
              "text": "Apps using AIsBreaker / Examples",
              "link": "/examples"
            }
          ]
        },
        {
          "text": "Server Details",
          "collapsed": false,
          "items": [
            {
              "text": "AIsBreaker Server",
              "link": "/aisbreaker-server"
            }
          ]
        },
        {
          "text": "AIsBreaker Development",
          "collapsed": false,
          "items": [
            {
              "text": "AIsBreaker for JavaScript/TypeScript",
              "base": "/deprecated/aisbreaker-api/docs/aisbreaker-api-js",
              "collapsed": false,
              "items": [
                {
                  "text": "AIsBreaker Packages",
                  "link": "/aisbreaker-packages"
                },
                {
                  "text": "Monorepo",
                  "link": "/monorepo"
                },
                {
                  "text": "Development Process",
                  "link": "/development-process"
                },
                {
                  "text": "Release and Deploy new Versions",
                  "link": "/release"
                }
              ]
            },
            {
              "text": "Writing Docs",
              "link": "/writing-docs/"
            }
          ]
        }
      ]
    },
    "/reference/": {
      "base": "/reference",
      "items": [
        {
          "text": "Reference",
          "items": [
            {
              "text": "Basics",
              "link": "/#basics"
            },
            {
              "text": "Services",
              "link": "/#services"
            },
            {
              "text": "Packages (TS/JS)",
              "link": "/#aisbreaker-packages-for-javascript-and-typescript"
            },
            {
              "text": "Remote REST API",
              "link": "/#aisbreaker-remote-rest-api"
            }
          ]
        }
      ]
    }
  },
  "editLink": {
    "pattern": "https://github.com/aisbreaker/aisbreaker.org-web/edit/main/site/:path"
  },
  "socialLinks": [
    {
      "icon": "github",
      "link": "https://github.com/aisbreaker/"
    },
    {
      "icon": {
        "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" role=\"image\" viewBox=\"0 0 16 16\"><title>Discussion</title><path fill=\"currentColor\" d=\"M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16ZM4 5v5a1 1 0 0 0 1 1h1v1.5a.5.5 0 0 0 .854.354L8.707 11H11a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1Z\"/></svg>"
      },
      "ariaLabel": "Discussion",
      "link": "https://github.com/orgs/aisbreaker/discussions/categories/general-disussion"
    }
  ],
  "lastUpdated": {
    "text": "Updated at (UTC)",
    "formatOptions": {
      "dateStyle": "medium",
      "timeStyle": "short",
      "hour12": false,
      "timeZone": "UTC"
    }
  },
  "search": {
    "provider": "local",
    "options": {
      "miniSearch": {
        "searchOptions": {}
      }
    }
  }
}

Page Data

{
  "title": "Runtime API Examples",
  "description": "",
  "frontmatter": {
    "outline": "deep",
    "head": [
      [
        "meta",
        {
          "name": "og:title",
          "content": "Runtime API Examples | AIsBreaker.org"
        }
      ],
      [
        "meta",
        {
          "name": "og:url",
          "content": "https://aisbreaker.org/deprecated/aisbreaker-api/docs/writing-docs/api-examples"
        }
      ],
      [
        "meta",
        {
          "name": "author",
          "content": "AIsBreaker.org"
        }
      ],
      [
        "link",
        {
          "rel": "canonical",
          "href": "https://aisbreaker.org/deprecated/aisbreaker-api/docs/writing-docs/api-examples"
        }
      ]
    ]
  },
  "headers": [],
  "relativePath": "deprecated/aisbreaker-api/docs/writing-docs/api-examples.md",
  "filePath": "deprecated/aisbreaker-api/docs/writing-docs/api-examples.md",
  "lastUpdated": 1725754947000
}

Page Frontmatter

{
  "outline": "deep",
  "head": [
    [
      "meta",
      {
        "name": "og:title",
        "content": "Runtime API Examples | AIsBreaker.org"
      }
    ],
    [
      "meta",
      {
        "name": "og:url",
        "content": "https://aisbreaker.org/deprecated/aisbreaker-api/docs/writing-docs/api-examples"
      }
    ],
    [
      "meta",
      {
        "name": "author",
        "content": "AIsBreaker.org"
      }
    ],
    [
      "link",
      {
        "rel": "canonical",
        "href": "https://aisbreaker.org/deprecated/aisbreaker-api/docs/writing-docs/api-examples"
      }
    ]
  ]
}

More

Check out the documentation for the full list of runtime APIs.

Released under the MIT License.