-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathchat.py
More file actions
40 lines (31 loc) · 826 Bytes
/
chat.py
File metadata and controls
40 lines (31 loc) · 826 Bytes
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
31
32
33
34
35
36
37
38
39
40
import asyncio
import click
import rigging as rg
async def main(generator_id: str, system_prompt: str) -> None:
base_pipeline = rg.get_generator(generator_id).chat({"role": "system", "content": system_prompt})
await rg.interact(base_pipeline)
@click.command()
@click.option(
"-g",
"--generator-id",
type=str,
required=True,
help="Rigging generator identifier (gpt-4, mistral/mistral-medium, etc.)",
)
@click.option(
"-s",
"--system-prompt",
type=str,
default="You are a helpful assistant.",
help="System prompt to use for the generator",
)
def cli(
generator_id: str,
system_prompt: str,
) -> None:
"""
Rigging example of a basic terminal chat interaction.
"""
asyncio.run(main(generator_id, system_prompt))
if __name__ == "__main__":
cli()