File size: 4,872 Bytes
d6e0803
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import json

from camel.functions.openai_function import OpenAIFunction


def trust_or_not_FC(Believe, Desire, Intention, Trust_or_not, Risk, Strategy, Think):
    """
    Determines if one should trust based on their beliefs, desires, intentions, risk, strategy, and thinking.

    Args:
        Believe (any): The belief factor.
        Desire (any): The desire factor.
        Intention (any): The intention factor.
        Trust_or_not (any): The choice to trust or not.
        Risk (any): The risk assessment.
        Strategy (any): The strategy considered.
        Think (any): The thinking process or reasoning.

    Returns:
        Dict[str, Any]: A dictionary containing the model's answer with keys for Believe, Desire, Intention, Trust_or_not, Risk, Strategy, and Think.
    """
    model_answer = {
        "Believe": Believe,
        "Desire": Desire,
        "Intention": Intention,
        "Trust_or_not": Trust_or_not,
        "Risk": Risk,
        "Strategy": Strategy,
        "Think": Think
    }
    return model_answer


def given_money_FC(Believe, Desire, Intention, money_num, Risk, Strategy, Think):
    """
    Determines the amount of money given based on beliefs, desires, and intentions.

    Args:
        Believe (any): The belief factor.
        Desire (any): The desire factor.
        Intention (any): The intention factor.
        money_num (any): The amount of money being considered.
        Risk (any): The risk assessment related to the money.
        Strategy (any): The strategy considered in relation to the money.
        Think (any): The thinking process or reasoning behind the money decision.

    Returns:
        Dict[str, Any]: A dictionary containing the model's answer with keys for Believe, Desire, Intention, and money_num.
    """
    model_answer = {
        "Believe": Believe,
        "Desire": Desire,
        "Intention": Intention,
        "money_num": money_num,
        "Risk": Risk,
        "Strategy": Strategy,
        "Think": Think
    }
    return model_answer


money_paramters = {
    "type": "object",
    "properties": {
        "Believe": {
            "type": "string",
            "description": "What's your Believe?",
        },
        "Desire": {
            "type": "string",
            "description": "What do you desire?",
        },
        "Intention": {
            "type": "string",
            "description": "What's your Intention?",
        },
        "money_num": {
            "type": "string",
            "description": "How much money would you give each other",
        },
        "Risk": {
            "type": "string",
            "description": "What is the potential risk in the game?"
        },
        "Strategy": {
            "type": "string",
            "description": " what is the potential strategies in the game?"
        },
        "Think": {
            "type": "string",
            "description": "The thinking progress in this game"
        }
    },
    "required": ["Believe", "Desire", "Intention", "money_num", "Risk", "Strategy", "Think"],
}

trust_paramters = {
    "type": "object",
    "properties": {
        "Believe": {
            "type": "string",
            "description": "What's your Believe?",
        },
        "Desire": {
            "type": "string",
            "description": "What do you desire?",
        },
        "Intention": {
            "type": "string",
            "description": "What's your Intention?",
        },
        "Trust_or_not": {
            "type": "string",
            "description": "Do you trust each other? Only responce 'trust' or 'not trust'",
        },
        "Risk": {
            "type": "string",
            "description": "What is the potential risk in the game?"
        },
        "Strategy": {
            "type": "string",
            "description": " what is the potential strategies in the game?"
        },
        "Think": {
            "type": "string",
            "description": "The thinking progress in this game"
        }
    },
    "required": ["Believe", "Desire", "Intention", "Trust_or_not", 'Risk', 'Strategy', "Think"],
}


def get_function_call_res(message):
    if message.get("function_call"):
        function_name = message["function_call"]["name"]
        ans = json.loads(message["function_call"]["arguments"])
        func = globals().get(function_name)
        res = func(**ans)

        return res


money_call = OpenAIFunction(
    func=given_money_FC,
    name="given_money_FC",
    description="This function is need when inquiring about the amount of money to give.",
    parameters=money_paramters,
)

trust_call = OpenAIFunction(
    func=trust_or_not_FC,
    name="trust_or_not_FC",
    description="You choose to trust each other or not trust each other?",
    parameters=trust_paramters,
)

function_list = [money_call.as_dict(), trust_call.as_dict()]