-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathexample.py
More file actions
31 lines (25 loc) · 1.08 KB
/
example.py
File metadata and controls
31 lines (25 loc) · 1.08 KB
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
from pluto import EngineArguments, DataEngine, Dataset, TopicTree, TopicTreeArguments
system_prompt = "You are a helpful AI coding assistant. You help software developers with their coding questions and write code for them. You do not just give high level coding advice, but instead, you tend to respond to coding questions with specific code examples."
tree = TopicTree(
args=TopicTreeArguments(
root_prompt="Functionalities of numpy",
model_system_prompt=system_prompt,
tree_degree=10,
tree_depth=2
)
)
tree.build_tree(model_name="gpt-3.5-turbo-1106")
tree.save("numpy_topictree.jsonl")
engine = DataEngine(
args=EngineArguments(
instructions="Please specifically provide training examples with questions about numpy. A training sample should consist of just one question and a response, and not a chat with multiple messages.",
system_prompt=system_prompt,
)
)
dataset = engine.create_data(
model_name="gpt-4-1106-preview",
num_steps=20,
batch_size=5,
topic_tree=tree
)
dataset.save("output_with_topictree.jsonl")