# Chain-of-Thought Operator
Chain of Thought (CoT) is a workflow operator that breaks down a complex problem into a series of intermediate steps or thoughts that lead to a final answer.

You can refer to the example in the `examples/cot` directory to understand how to use this operator.

# Inputs, Outputs and configs

## Inputs:
The inputs that the Chain of Thought (CoT) operator requires are as follows:
| Name        | Type | Required | Description |
| ----------- | ----- | -------- | ----------- |
| query       | str   | true     | The user's question |
| cot_method  | str   | optional | The CoT method: `few_shot` or `zero_shot` |
| cot_examples| list  | optional | Examples used for the `few_shot` CoT method |
| id          | int   | optional | An identifier for tracking the question |

## Outputs:
The outputs that the Chain of Thought (CoT) operator returns are as follows:
| Name     | Type | Description |
| -------- | ----- | ---- |
| id | int |  An identifier for tracking the question |
| question | str |  The complete prompt string containing the query |
| last_output | str | The final answer generated by the agent |
| prompt_tokens | int | The total number of tokens in the question |
| completion_tokens | int | The total number of tokens in the answer |

## Configs:
The config of the Chain of Thought (CoT) operator is as follows, you can simply copy and paste the following config into your project as a cot_workflow.yml file.
```yml
- name: CoTReasoning
  llm: ${sub|gpt4o}
  output_parser: 
    name: StrParser
  concurrency: 15

```