File size: 2,140 Bytes
e233c57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
name: "Code_Flow"
verbose: True
description: "ToDO: add description"

model_name: "gpt-4"
generation_parameters:
  n: 1
  max_tokens: 3000
  temperature: 0.3

  model_kwargs:
    top_p: 0.2
    frequency_penalty: 0
    presence_penalty: 0

system_message_prompt_template:
  _target_: langchain.PromptTemplate
  template: |2-
    Your goal is to provide executable Python code that solves a coding interview problem. The code should correctly handle all corner cases in order to pass the hidden test cases, which are used to evaluate the correctness of the solution.

    The user will specify the problem by providing you with:
      - the problem statement
      - example test cases
      - the constraints of the problem

    The user will provide you with a task and an output format that you will strictly follow.
  input_variables: []
  template_format: jinja2

human_message_prompt_template:
  _target_: langchain.PromptTemplate
  template: "{{query}}"
  input_variables:
    - "query"
  template_format: jinja2

query_message_prompt_template:
  _target_: langchain.PromptTemplate
  template: |2-
    # Problem statement
    {{problem_description}}

    {{io_description}}

    # Constraints
    {{constraints}}


    Return Python code that solves the problem. The code should extend the following stub:
    ```python
    {{python_stub}}
    ```
    without changing the method signatures.
    Reply in the following format:
    ```python
    {{code_placeholder}}
    ```
  input_variables:
    - "problem_description"
    - "io_description"
    - "constraints"
    - "python_stub"
  partial_variables:
    code_placeholder: "{{python_code}}"
  template_format: jinja2

input_data_transformations: []
input_keys:
    - "problem_description"
    - "io_description"
    - "constraints"
    - "python_stub"

output_data_transformations:
  - _target_: flows.data_transformations.RegexFirstOccurrenceExtractor
    regex: '(?<=```python)([\s\S]*?)(?=```)'
    regex_fallback: '(?<=```)([\s\S]*?)(?=```)'
    input_key: "raw_response"
    output_key: "code"
    strip: True
    assert_unique: True
    verbose: True
output_keys:
  - "code"