forked from defenseunicorns/leapfrogai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
41 lines (31 loc) · 1.08 KB
/
test.py
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
41
import copy
import sys
from pathlib import Path
from typing import Iterator
path_root = Path(__file__).parents[2]
sys.path.append(str(path_root))
print(sys.path)
import grpc
import leapfrogai
system_prompt = """<|im_start|>system
You are an AI assistant that answers participates in chat discussions in an honest, concise, friendly way.<|im_end|>
<|im_start|>user
Write two sequences composed of 3 'A's and 2 'B's such that there are no two successive identical letter. Be concise.<|im_end|>
<|im_start|>assistant
"""
def run():
# Set up a channel to the server
with grpc.insecure_channel("localhost:50051") as channel:
# Instantiate a stub (client)
stub = leapfrogai.CompletionServiceStub(channel)
# Create a request
request = leapfrogai.CompletionRequest(
prompt=system_prompt,
max_new_tokens=512,
temperature=1.0,
)
# Make a call to the server and get a response
response: leapfrogai.CompletionResponse = stub.Complete(request)
print(response)
if __name__ == "__main__":
run()