File size: 2,555 Bytes
d1009a4
 
70aa23a
d1009a4
70aa23a
d1009a4
70aa23a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
faa9fb4
70aa23a
 
d1009a4
70aa23a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d1009a4
70aa23a
 
 
 
 
 
d1009a4
 
70aa23a
d1009a4
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import asyncio
from pprint import pprint
from utils.freeplay_helpers import FreeplayClient
import datetime
import time

from tools import (
    PlayerSearchTool,
    GameSearchTool,
)


available_tools = [
    GameSearchTool(),
    PlayerSearchTool(),
]


template = "casual_fan_prompt"
environment = "latest"
variables = {
    "now": datetime.datetime.now(datetime.UTC).strftime('%Y-%m-%d'),
    "zep_context": "Zep is your daddy",
}
# history = [
#     {"role": "user", "content": "what are some dinner ideas..."},
#     {"role": "assistant", "content": "all you should eat is steamed broccoli - you will live forever"},
#     {"role": "user", "content": "i don't want to live forever if all i eat is steamed broccoli"},
#     {"role": "assistant", "content": "silly human"},
# ]
# history = [
#     {'role': 'human', 'content': 'tell me about some players in everglade fc'},
#     # {'role': 'tool', 'content': '{"number": 23, "name": "Brian Davis", "age": 27, "nationality": "USA", "shirt_number"...c image full of energy and anticipation."}'},
#     # {'role': 'tool', 'content': '{"number": 10, "name": "Matthew Martin", "age": 24, "nationality": "USA", "shirt_numb...he dramatic flair he brings to the game."}'},
#     {'role': 'ai', 'content': 'Everglade FC is bursting with talent! Here are some standout players to watch:\n\n1. **...rglade FC brings to the field! Go, team! 🌟'},
# ]
history = [
    {'role': 'user', 'content': 'tell me about some players in everglade fc'},
    {'role': 'tool', 'content': '{"number": 23, "name": "Brian Davis", "age": 27, "nationality": "USA", "shirt_number"...c image full of energy and anticipation."}', 'tool_call_id': 'abc123'},
    {'role': 'assistant', 'content': 'Everglade FC is bursting with talent! Here are some standout players to watch:\n\n1. **...rglade FC brings to the field! Go, team! 🌟'},
]

fp_client = FreeplayClient()
prompt = fp_client.get_prompt(template, environment)

formatted_prompt = prompt.bind(variables, history=history).format()


def main():
    print(formatted_prompt.llm_prompt)
    print('================')
    tool_schema = [tool.input_schema.schema_json() for tool in available_tools]
    print(tool_schema)
    print('================')

    state = {
        "start_time": time.time(),
        "messages": history,
    }
    # variables['history'] = history

    fp_client.create_session()
    fp_client.record_session(
        state=state,
        prompt_vars=variables,
        formatted_prompt=formatted_prompt,
    )

if __name__ == "__main__":
    main()