# ask

The `ask` function is designed for seamless interaction with the AI chat named Cloude using `Asynchronous`.

#### Properties:

* **`prompt`**: Your query or message sent to the AI.
* **`history`**: The conversation history, which must be an object of type `AsyncHistory`.

#### Example Usage:

{% tabs %}
{% tab title="First" %}

```python
from litegpt import AsyncLiteGPT
import asyncio

async def main():
    bot = AsyncLiteGPT(http2=True)
    print(await bot.ask("Your query text..."))
    
asyncio.run(main())
```

{% endtab %}

{% tab title="Second" %}

```python
from litegpt import AsyncLiteGPT
from litegpt.lib import AsyncHistory
import asyncio
# Creating a Asynchronous history object and adding messages
async def main():
    history = AsyncHistory()
    await history.insert([
        ("system", "system options here!"),
        ("assistant", "assistant first message!"),
        ("user", "user message here!"),
        ("assistant", "assistant second message!")
        ])

    # Initializing the LiteGPT object and sending a request
    bot = LiteGPT(http2=True)
    print(await bot.ask("Your query text...", history))
    
asyncio.run(main())
```

{% endtab %}
{% endtabs %}

Thus, the `ask` function provides a convenient and efficient way to send queries to the AI chat while maintaining the dialogue context.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://red-3.gitbook.io/litegpt/async/asynclitegpt/ask.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
