File size: 1,273 Bytes
0e02b97
 
 
 
 
9f82d8d
0e02b97
 
 
27b075e
69e31cd
4ff72e9
4477cf4
c22c463
 
69e31cd
 
 
596848e
d0252db
0e02b97
 
 
 
 
 
 
9f82d8d
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from __future__ import annotations

import asyncio

from src.chat import ChatSession
from src.vm import VMRegistry


async def _main() -> None:
    async with ChatSession(user="demo_user", session="demo_session") as chat:
        doc_path = chat.upload_document("note.pdf")
        # print(f"Document uploaded to VM at: {doc_path}")
        # answer = await chat.chat(f"Remove all contents of test.txt and add the text 'Hello, World!' to it.")
        # async for resp in chat.chat_stream("Erase the contents of test.txt and write 'Hello, World!' to it."):
        # async for resp in chat.chat_stream("Verify that the file test.txt exists and contains the text 'Hello, World!'."):
        # async for resp in chat.chat_stream("Inspect the contents of note.pdf and summarize it."):
        # async for resp in chat.chat_stream("What is the content of the document I uploaded?"):
        # async for resp in chat.chat_stream("Install necessary package(s) to read PDF files and edit them."):
        async for resp in chat.chat_stream("Look up the current weather in San Francisco."):
            print("\n>>>", resp)


if __name__ == "__main__":
    try:
        asyncio.run(_main())
    except KeyboardInterrupt:
        pass
    finally:
        VMRegistry.shutdown_all()