-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_cot.py
More file actions
25 lines (17 loc) · 829 Bytes
/
test_cot.py
File metadata and controls
25 lines (17 loc) · 829 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
from langchain_core.messages import HumanMessage, AIMessage, AnyMessage
from seedgen2.graphs.cotbot import CoT
import logging
from seedgen2.presets import SeedGen2GenerativeModel
logging.basicConfig(level=logging.INFO)
prompt = """
A farmer needs to cross a river with two chickens. The boat only has room for one human and two animals. What is the smallest number of crossings needed for the farmer to get across with the two chickens?
"""
print("COT result:")
model = CoT(model=SeedGen2GenerativeModel().model,
json_model=SeedGen2GenerativeModel().json_model)
print(model.invoke([HumanMessage(content=prompt)]).content)
print("Chain-of-thought:")
print(model.get_chain_of_thought())
print("Normal result:")
model = SeedGen2GenerativeModel().model
print(model.invoke([HumanMessage(content=prompt)]).content)