Skip to content

Openai reasoning

reasoning_temporal_questions(prompt)

Parameters:

Name Type Description Default
prompt str

The question to reason.

required
Source code in TimelineKGQA/reasoning/openai_reasoning.py
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
def reasoning_temporal_questions(prompt: str):
    """

    Args:
        prompt (str): The question to reason.
    """
    try:
        logger.info(f"Reasoning the question: {prompt}")
        res = client.chat.completions.create(
            model="gpt-3.5-turbo",
            messages=[
                {
                    "role": "system",
                    "content": """You are an expert on reasoning temporal questions.
                                  Give us the answer to the following question.
                                  """,
                },
                {
                    "role": "user",
                    "content": prompt,
                },
            ],
        )
        return res.choices[0].message.content
    except Exception as e:
        logger.error(e)
        return ""