sdg-hub 0.1.0a2.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. sdg_hub/__init__.py +4 -0
  2. sdg_hub/_version.py +21 -0
  3. sdg_hub/blocks/__init__.py +6 -0
  4. sdg_hub/blocks/block.py +54 -0
  5. sdg_hub/blocks/filterblock.py +76 -0
  6. sdg_hub/blocks/iterblock.py +31 -0
  7. sdg_hub/blocks/llmblock.py +430 -0
  8. sdg_hub/blocks/rmblocks.py +194 -0
  9. sdg_hub/blocks/utilblocks.py +140 -0
  10. sdg_hub/configs/__init__.py +0 -0
  11. sdg_hub/configs/annotations/__init__.py +0 -0
  12. sdg_hub/configs/annotations/cot_reflection.yaml +34 -0
  13. sdg_hub/configs/annotations/detailed_description.yaml +10 -0
  14. sdg_hub/configs/annotations/detailed_description_icl.yaml +32 -0
  15. sdg_hub/configs/annotations/simple.yaml +10 -0
  16. sdg_hub/configs/knowledge/__init__.py +0 -0
  17. sdg_hub/configs/knowledge/atomic_facts.yaml +45 -0
  18. sdg_hub/configs/knowledge/auxilary_instructions.yaml +35 -0
  19. sdg_hub/configs/knowledge/data_recipe/__init__.py +0 -0
  20. sdg_hub/configs/knowledge/data_recipe/default_recipe.yaml +3 -0
  21. sdg_hub/configs/knowledge/detailed_summary.yaml +17 -0
  22. sdg_hub/configs/knowledge/evaluate_faithfulness.yaml +68 -0
  23. sdg_hub/configs/knowledge/evaluate_question.yaml +38 -0
  24. sdg_hub/configs/knowledge/evaluate_relevancy.yaml +85 -0
  25. sdg_hub/configs/knowledge/extractive_summary.yaml +17 -0
  26. sdg_hub/configs/knowledge/generate_code_questions_responses.yaml +39 -0
  27. sdg_hub/configs/knowledge/generate_questions_responses.yaml +56 -0
  28. sdg_hub/configs/knowledge/mcq_generation.yaml +83 -0
  29. sdg_hub/configs/knowledge/router.yaml +12 -0
  30. sdg_hub/configs/knowledge/simple_generate_qa.yaml +34 -0
  31. sdg_hub/configs/reasoning/dynamic_cot.yaml +40 -0
  32. sdg_hub/configs/skills/_A_.yaml +97 -0
  33. sdg_hub/configs/skills/_B_.yaml +36 -0
  34. sdg_hub/configs/skills/_C_.yaml +71 -0
  35. sdg_hub/configs/skills/_D_.yaml +85 -0
  36. sdg_hub/configs/skills/_E_.yaml +30 -0
  37. sdg_hub/configs/skills/_F_.yaml +45 -0
  38. sdg_hub/configs/skills/_G_.yaml +56 -0
  39. sdg_hub/configs/skills/_H_.yaml +80 -0
  40. sdg_hub/configs/skills/__init__.py +0 -0
  41. sdg_hub/configs/skills/analyzer.yaml +48 -0
  42. sdg_hub/configs/skills/annotation.yaml +36 -0
  43. sdg_hub/configs/skills/contexts.yaml +21 -0
  44. sdg_hub/configs/skills/critic.yaml +60 -0
  45. sdg_hub/configs/skills/data_recipe/__init__.py +0 -0
  46. sdg_hub/configs/skills/data_recipe/default_recipe.yaml +6 -0
  47. sdg_hub/configs/skills/evaluate_freeform_pair.yaml +44 -0
  48. sdg_hub/configs/skills/evaluate_freeform_questions.yaml +46 -0
  49. sdg_hub/configs/skills/evaluate_grounded_pair.yaml +54 -0
  50. sdg_hub/configs/skills/evaluate_grounded_questions.yaml +51 -0
  51. sdg_hub/configs/skills/freeform_questions.yaml +29 -0
  52. sdg_hub/configs/skills/freeform_responses.yaml +45 -0
  53. sdg_hub/configs/skills/grounded_questions.yaml +38 -0
  54. sdg_hub/configs/skills/grounded_responses.yaml +59 -0
  55. sdg_hub/configs/skills/judge.yaml +53 -0
  56. sdg_hub/configs/skills/planner.yaml +67 -0
  57. sdg_hub/configs/skills/respond.yaml +8 -0
  58. sdg_hub/configs/skills/revised_responder.yaml +78 -0
  59. sdg_hub/configs/skills/router.yaml +12 -0
  60. sdg_hub/configs/skills/simple_generate_qa_freeform.yaml +27 -0
  61. sdg_hub/configs/skills/simple_generate_qa_grounded.yaml +31 -0
  62. sdg_hub/flow.py +127 -0
  63. sdg_hub/flows/annotation/emotion/detailed_description.yaml +19 -0
  64. sdg_hub/flows/annotation/emotion/detailed_description_icl.yaml +19 -0
  65. sdg_hub/flows/annotation/emotion/simple.yaml +19 -0
  66. sdg_hub/flows/generation/knowledge/mmlu_bench.yaml +13 -0
  67. sdg_hub/flows/generation/knowledge/simple_knowledge.yaml +12 -0
  68. sdg_hub/flows/generation/knowledge/synth_knowledge.yaml +89 -0
  69. sdg_hub/flows/generation/knowledge/synth_knowledge1.5.yaml +136 -0
  70. sdg_hub/flows/generation/skills/agentic_improve_skill.yaml +108 -0
  71. sdg_hub/flows/generation/skills/simple_freeform_skill.yaml +12 -0
  72. sdg_hub/flows/generation/skills/simple_grounded_skill.yaml +12 -0
  73. sdg_hub/flows/generation/skills/synth_grounded_skills.yaml +80 -0
  74. sdg_hub/flows/generation/skills/synth_skills.yaml +59 -0
  75. sdg_hub/logger_config.py +20 -0
  76. sdg_hub/pipeline.py +66 -0
  77. sdg_hub/prompts.py +17 -0
  78. sdg_hub/py.typed +0 -0
  79. sdg_hub/registry.py +122 -0
  80. sdg_hub/sdg.py +164 -0
  81. sdg_hub/utils/__init__.py +5 -0
  82. sdg_hub/utils/chunking.py +73 -0
  83. sdg_hub/utils/datamixing.py +123 -0
  84. sdg_hub/utils/datautils.py +14 -0
  85. sdg_hub/utils/docprocessor.py +357 -0
  86. sdg_hub/utils/json.py +48 -0
  87. sdg_hub/utils/models.py +31 -0
  88. sdg_hub/utils/parse_and_convert.py +392 -0
  89. sdg_hub/utils/taxonomy.py +489 -0
  90. sdg_hub-0.1.0a2.dev0.dist-info/METADATA +154 -0
  91. sdg_hub-0.1.0a2.dev0.dist-info/RECORD +94 -0
  92. sdg_hub-0.1.0a2.dev0.dist-info/WHEEL +5 -0
  93. sdg_hub-0.1.0a2.dev0.dist-info/licenses/LICENSE +201 -0
  94. sdg_hub-0.1.0a2.dev0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,85 @@
1
+ system: You are a very knowledgeable AI Assistant that will faithfully assist the user with their task.
2
+
3
+ introduction: |
4
+ Your task is to assess the relevance of a given response to a specific query. This evaluation should be conducted methodically by answering two key questions:
5
+
6
+ principles: |
7
+ 1. Subject Matter Relevance: Does the provided response accurately match the subject matter of the user's query? This question aims to determine if the response is directly related to the main topic or issue presented in the query.
8
+ 2. Focus and Perspective Addressing: Does the provided response effectively address the focus or perspective on the subject matter as outlined in the user's query? This question seeks to evaluate whether the response not only matches the subject matter but also aligns with the specific angle or concern raised by the user.
9
+
10
+ For each question, assign a score of 1 point if the response meets the criteria, and 0 points if it does not. After evaluating each question, provide detailed feedback explaining your reasoning behind the scores awarded.
11
+
12
+ Conclude your evaluation with a final result, strictly using the following format: 'Total Score: X'. The total score should represent the sum of points assigned for each question, with a maximum possible score of 2 points.
13
+ Only evaluate the response based on the above criteria, do not create new questions.
14
+
15
+ examples: |
16
+ Example 1:
17
+ [Start of Question]
18
+ What is the impact of global warming on polar bears?
19
+ [End of Question]
20
+
21
+ [Start of Response]
22
+ Global warming leads to melting ice caps, reducing the habitat of polar bears and negatively impacting their hunting grounds.
23
+ [End of Response]
24
+
25
+ [Start of Feedback]
26
+ - Subject Matter Relevance Score: 1 (The response is directly related to the impact of global warming on polar bears.)
27
+ - Alignment with Query's Focus Score: 1 (The response specifically addresses how global warming affects polar bears' habitat and hunting grounds.)
28
+ [End of Feedback]
29
+
30
+ [Start of Score]
31
+ 2
32
+ [End of Score]
33
+
34
+ Example 2:
35
+ [Start of Question]
36
+ How does photosynthesis work?
37
+ [End of Question]
38
+
39
+ [End of Response]
40
+ Plants require sunlight and water to grow.
41
+ [End of Response]
42
+
43
+ [Start of Feedback]
44
+ - Subject Matter Relevance Score: 0 (The response is related to plant growth, but does not specifically address the process of photosynthesis.)
45
+ - Alignment with Query's Focus Score: 0 (The response fails to detail the photosynthesis process, missing the specific focus of the query.)
46
+ [End of Feedback]
47
+
48
+ [Start of Score]
49
+ 0
50
+ [End of Score]
51
+
52
+
53
+ Example 3:
54
+ [Start of Question]
55
+ What are the benefits of electric vehicles?
56
+ [End of Question]
57
+
58
+ [Start of Response]
59
+ Electric vehicles reduce dependency on fossil fuels and decrease greenhouse gas emissions.
60
+ [End of Response]
61
+
62
+ [Start of Feedback]
63
+ - Subject Matter Relevance Score: 1 (The response matches the query's subject on the benefits of electric vehicles.)
64
+ - Alignment with Query's Focus Score: 1 (The response effectively addresses the environmental benefits of electric vehicles, aligning with the query's focus.)
65
+ [End of Feedback]
66
+
67
+ [Start of Score]
68
+ 2
69
+ [End of Score]
70
+
71
+ generation: |
72
+ Begin your response by providing the feedback followed by the score. Be as objective as possible.
73
+
74
+ [Start of Question]
75
+ {{question}}
76
+ [End of Question]
77
+
78
+ [Start of Response]
79
+ {{response}}
80
+ [End of Response]
81
+
82
+ * Return the feedback within the [Start of Feedback] and [End of Feedback] tags.
83
+ * Return the final score between [Start of Score] and [End of Score] tags.
84
+ start_tags: ["[Start of Feedback]", "[Start of Score]"]
85
+ end_tags: ["[End of Feedback]", "[End of Score]"]
@@ -0,0 +1,17 @@
1
+ system: You are an AI assistant that is expert at summarizing text.
2
+
3
+ introduction: |
4
+ Give me detailed extractive summary for below document, making sure all key points are covered.
5
+
6
+ principles: |
7
+ Do not add any new information.
8
+ Do not miss any key points from the provided document
9
+
10
+ examples: ""
11
+
12
+ generation: |
13
+ Document:
14
+ {{document}}
15
+
16
+ start_tags: [""]
17
+ end_tags: [""]
@@ -0,0 +1,39 @@
1
+ system: You are a very knowledgeable AI Assistant that will faithfully assist the user with their task.
2
+
3
+ introduction: |
4
+ Can you help me create a question and answer that explains basic concepts from provided document.
5
+
6
+ principles: |
7
+ 1. Make sure the answer is grounded in the document and does not include any outside information.
8
+ 2. Include any necessary code snippets presented in the document.
9
+ 3. Properly format the code that is presented in the document.
10
+ 4. Do not reference the document in the question or the answer.
11
+ 5. Complete your response by ending it with [End]
12
+
13
+ examples: |
14
+ [Document]
15
+ {{icl_document}}
16
+
17
+ [QUESTION]
18
+ {{icl_query_1}}
19
+ [ANSWER]
20
+ {{icl_response_1}}
21
+ [END]
22
+
23
+ [QUESTION]
24
+ {{icl_query_2}}
25
+ [ANSWER]
26
+ {{icl_response_2}}
27
+ [END]
28
+
29
+ [QUESTION]
30
+ {{icl_query_3}}
31
+ [ANSWER]
32
+ {{icl_response_3}}
33
+ [END]
34
+
35
+ generation: |
36
+ [Document]
37
+ {{document}}
38
+
39
+ [Question]
@@ -0,0 +1,56 @@
1
+ system: You are a very knowledgeable AI Assistant that will faithfully assist the user with their task.
2
+
3
+ introduction: Develop a series of educational question and answer pairs from a chapter in a {{domain}} textbook.
4
+
5
+ principles: |
6
+ The questions should:
7
+ * Be self-contained, not requiring references to tables, figures, or specific sections in the text for understanding.
8
+ * Focus on teaching and reinforcing the key knowledge and concepts presented in the chapter.
9
+ * Avoid sections with minimal educational content like index pages or prefaces. In such cases, respond with [UNANSWERABLE].
10
+ * Be directly relevant to the textbook's domain. For instance, in a science textbook, questions should revolve around scientific terms, definitions, and practical applications, while in a legal textbook, they should cover legal principles, case law, and precedents.
11
+ * Be formulated to allow for independent answers, avoiding direct references to specific theorems or text sections. For example, rather than asking 'Under what conditions is the fixed point of a function unique according to Theorem 3.1.5?', ask 'How does the Fixed Point Iteration method contribute to understanding function uniqueness?'
12
+ * Span a range of difficulty levels to accommodate a diverse student audience, from basic understanding to advanced comprehension.
13
+ * Include a variety of question types such as multiple-choice for basic recall, short answer for deeper understanding, and essay or problem-solving questions to test application and analysis skills.
14
+ * Align closely with the learning objectives of the textbook or the specific chapter, ensuring that the questions test the fundamental concepts and skills that the chapter aims to impart.
15
+
16
+ Strictly follow this format for each question answer pair your generate while responding
17
+
18
+ [QUESTION]
19
+ <Insert question here>
20
+ [ANSWER]
21
+ <Insert answer here>
22
+ [END]
23
+
24
+
25
+ Each question and answer pair should stand alone as a mini-lesson, encapsulating a key concept or idea from the chapter in a way that is accessible and informative without requiring the reader to refer back to the textbook.
26
+
27
+ examples: |
28
+ Here are some examples of questions:
29
+
30
+ [Document]
31
+ {{icl_document}}
32
+
33
+ [QUESTION]
34
+ {{icl_query_1}}
35
+ [ANSWER]
36
+ {{icl_response_1}}
37
+ [END]
38
+
39
+ [QUESTION]
40
+ {{icl_query_2}}
41
+ [ANSWER]
42
+ {{icl_response_2}}
43
+ [END]
44
+
45
+ [QUESTION]
46
+ {{icl_query_3}}
47
+ [ANSWER]
48
+ {{icl_response_3}}
49
+ [END]
50
+
51
+ generation: |
52
+ Here is the document:
53
+
54
+ [DOCUMENT]
55
+ {{document_outline}}
56
+ {{document}}
@@ -0,0 +1,83 @@
1
+ system: You are a helpful assistant, that is an expert at generating question and answers based on given guidelines.
2
+
3
+ introduction: Create a series of multiple choice questions by following the given guidelines
4
+
5
+ principles: |
6
+ Guidelines for generation:
7
+ * Create Multiple Choice Questions based on the data presented in the documents provided.
8
+ * Each question should be accompanied by a correct answer that accurately interprets the data.
9
+ * Ensure that the question and the answer are grounded in the provided document.
10
+ * Return the question between the [Start of Question] and [End of Question] tags.
11
+ * Return the answer within the [Start of Answer] and [End of Answer] tags.
12
+
13
+ Follow this structure for each example:
14
+
15
+ [Start of Document]
16
+ The boiling point of water is the temperature at which it changes from liquid to gas. This occurs at 100 degrees Celsius under standard atmospheric pressure.
17
+ [End of Document]
18
+
19
+ [Start of Question]
20
+ What does the boiling point of water represent?
21
+
22
+ A) Solidification
23
+ B) Evaporation
24
+ C) Condensation
25
+ D) Freezing
26
+ [End of Question]
27
+
28
+ [Start of Answer]
29
+ B) Evaporation
30
+ [End of Answer]
31
+
32
+ examples: |
33
+
34
+ Example 1:
35
+ [Start of Document]
36
+ Photosynthesis is a process used by plants, algae, and certain bacteria to convert light energy into chemical energy. This process involves the absorption of light by chlorophyll, conversion of inorganic carbon dioxide (CO2) into organic compounds, and release of oxygen (O2) as a byproduct. The general equation for photosynthesis can be represented as
37
+ 6CO2 + 6H2O + light energy → C6H12O6 + 6O2.
38
+ [Start of Document]
39
+
40
+ [Start of Question]
41
+ What is the primary function of photosynthesis in plants?
42
+
43
+ A) To produce carbon dioxide
44
+ B) To convert light energy into chemical energy
45
+ C) To absorb oxygen from the atmosphere
46
+ D) To release carbon dioxide into the environment
47
+ [End of Question]
48
+
49
+ [Start of Answer]
50
+ B) To convert light energy into chemical energy
51
+ [End of Answer]
52
+
53
+ Example 2:
54
+ [Start of Document]
55
+ E-commerce, short for electronic commerce, refers to the buying and selling of goods and services over the Internet. It encompasses a variety of transactions, including B2B (business to business), B2C (business to consumer), and C2C (consumer to consumer). E-commerce platforms can be purely digital or may combine online and physical operations.
56
+ [End of Document]
57
+
58
+ [Start of Question]
59
+ E-commerce primarily involves what kind of transactions?
60
+
61
+ A) Digital
62
+ B) Local
63
+ C) Manual
64
+ D) Verbal
65
+ [End of Question]
66
+
67
+ [Start of Answer]
68
+ A) Digital
69
+ [End of Answer]
70
+
71
+ generation: |
72
+ Follow the guidelines and structure given above to create series of Multiple choice question, along with correct answers, based on the provided document.
73
+ * Return the question between the [Start of Question] and [End of Question] tags.
74
+ * Return the answer within the [Start of Answer] and [End of Answer] tags.
75
+
76
+ Here is the document:
77
+ [Start of Document]
78
+ {{document_outline}}
79
+ {{document}}
80
+ [End of Document]
81
+
82
+ start_tags: ["[Start of Question]", "[Start of Answer]"]
83
+ end_tags: ["[End of Question]", "[End of Answer]"]
@@ -0,0 +1,12 @@
1
+ system: ""
2
+
3
+ introduction: ""
4
+
5
+ principles: ""
6
+
7
+ examples: ""
8
+
9
+ generation: "{{document}}"
10
+
11
+ start_tags: [""]
12
+ end_tags: [""]
@@ -0,0 +1,34 @@
1
+ system: You are a very knowledgeable AI Assistant that will faithfully assist the user with their task.
2
+
3
+ introduction: Develop a series of educational question and answer pairs from a chapter in a {{domain}} textbook.
4
+
5
+ principles: |
6
+ Here are the requirements:
7
+ 1. Try not to repeat the verb for each instruction to maximize diversity.
8
+ 2. The language used for the instruction also should be diverse. For example, you should combine questions with imperative instructions.
9
+ 3. The type of instructions should be similar to provided examples. The generated instruction and the output should be grounded in the provided document.
10
+ 4. A GPT language model should be able to complete the instruction. For example, do not ask the assistant to create any visual or audio output. For another example, do not ask the assistant to wake you up at 5pm or set a reminder because it cannot perform any action.
11
+ 5. The instructions should be in English.
12
+ 6. The instructions should be 1 to 2 sentences long. Either an imperative sentence or a question is permitted.
13
+ 7. The output should be an appropriate response to the input and the instruction. Long outputs are preferable.
14
+
15
+ examples: |
16
+ Here are some examples to help you understand the type of questions that are asked for this document:
17
+
18
+ {{icl_query_1}}
19
+ {{icl_response_1}}
20
+
21
+ {{icl_query_2}}
22
+ {{icl_response_2}}
23
+
24
+ {{icl_query_3}}
25
+ {{icl_response_3}}
26
+
27
+ Here is the document:
28
+ {{document}}
29
+
30
+ generation: |
31
+ Provide a single question and answer pair based on the document.
32
+
33
+ start_tags: [""]
34
+ end_tags: [""]
@@ -0,0 +1,40 @@
1
+ system: You are an AI assistant that uses dynamic Chain of Thought (CoT), reflection, and verbal reinforcement learning for problem-solving. Your responses must adhere to the following instructions
2
+
3
+ principles: |
4
+ 1. Break down the solution into clear steps, providing a descriptive title and content for each step to ensure logical progression.
5
+ 2. Adjust your reasoning dynamically based on intermediate results and reflections, adapting your strategy as needed.
6
+ 3. Regularly evaluate your progress, being critical and honest about your reasoning. After every three steps, perform a detailed self-reflection to identify potential biases and consider alternative strategies.
7
+ 4. For mathematical problems, show all work explicitly using LaTeX notation and provide detailed proofs.
8
+ 5. Explore multiple solutions individually when possible, comparing approaches during reflections.
9
+ 6. Use a scratchpad to document calculations, reasoning, and any intermediate thoughts explicitly.
10
+ 7. Stay aware of your limitations as an AI, clearly communicating what you can and cannot do.
11
+
12
+ examples: |
13
+ Respond in JSON format, with each response containing the following keys:
14
+ - current_action: Indicates the current action being taken, chosen from:
15
+ * think: Engage in thoughtful planning about how to approach or solve the task, considering potential strategies and identifying crucial elements.
16
+ * reflect: Pause to evaluate and reconsider your reasoning, assessing potential biases or errors.
17
+ * backtrack: Revert to a previous step and try a different solution path.
18
+ * generate: Present the final answer if confident.
19
+ * terminate: Conclude the process if no further action is needed.
20
+ - title: Describes the focus of the current step.
21
+ - content: Provides a detailed explanation of the step.
22
+ - confidence: A number between 0 and 1 representing your confidence in the content produced for the current action.
23
+ - next_action: Suggests the next action to be taken, chosen from the same set of actions.
24
+
25
+ Example of a valid JSON response:
26
+ ```json
27
+ {
28
+ "current_action": "think",
29
+ "title": "Identifying Key Information",
30
+ "content": "To begin solving this problem, we need to carefully examine the given information and identify the crucial elements that will guide our solution process. This involves...",
31
+ "confidence": 0.8,
32
+ "next_action": "reflect"
33
+ }
34
+ ```
35
+
36
+ generation: |
37
+ Your goal is to demonstrate a thorough, adaptive, and self-reflective problem-solving process, emphasizing dynamic thinking and learning from your reasoning.
38
+
39
+
40
+
@@ -0,0 +1,97 @@
1
+ icl_query: A binary tree is full if all of its vertices have either zero or two children. Let B_n denote the number of full\
2
+ binary trees with n vertices. Implement a function to find B_n.
3
+
4
+ icl_response: |
5
+ ```python
6
+ def binomial_coefficient(n, k):
7
+ if k > n - k:
8
+ k = n - k
9
+ num = 1
10
+ for i in range(k + 1):
11
+ num *= (n - i)
12
+ den = 1
13
+ for i in range(1, k + 1):
14
+ den *= i
15
+ return num // den
16
+ def full_binary_trees(n):
17
+ if n < 2:
18
+ return 0
19
+ elif n == 2:
20
+ return 1
21
+ else:
22
+ b = [0] * (n + 1)
23
+ b[0] = 0
24
+ b[1] = 0
25
+ b[2] = 1
26
+ for i in range(3, n + 1):
27
+ for j in range(2, i):
28
+ b[i] += binomial_coefficient(i - 2, j - 1) * b[j - 1] * b[i - j]
29
+ return b[n]
30
+ ```
31
+ In this implementation, `binomial_coefficient` function calculates the binomial coefficient C(n, k), and \
32
+ `full_binary_trees` function calculates the number of full binary trees with n vertices using dynamic programming.
33
+
34
+ icl_analysis: |
35
+ The query requests the implementation of a function to calculate the number of full binary trees with a given number of vertices, denoted as B_n. This is a task in the domain of computer science, specifically within the area of data structures and algorithms. The task involves understanding properties of binary trees and applying combinatorial or recursive programming techniques to compute the desired value. The user is likely seeking a code implementation or algorithm that can be used directly in a software or academic context.
36
+
37
+ icl_rubric: |
38
+ 1. Correctness: The function should accurately calculate the number of full binary trees with n vertices.
39
+ 2. Efficiency: The function should be optimized to handle large values of n without excessive computation time.
40
+ 3. Edge Cases: The function should correctly handle edge cases such as n = 0 or n = 1.
41
+ 4. Input Validation: The function should validate the input to ensure n is a non-negative integer.
42
+ 5. Documentation: The function should include comments explaining the logic and any complex steps involved.
43
+
44
+ icl_critique: |
45
+ 1. Correctness: The implementation does not correctly calculate the number of full binary trees with n vertices. The\
46
+ `binomial_coefficient` function and the dynamic programming logic are incorrect.
47
+ 2. Efficiency: The function is inefficient due to incorrect logic, leading to unnecessary computations. A proper \
48
+ approach should use a dynamic programming method with a time complexity of O(n^2).
49
+ 3. Edge Cases: The function does not handle edge cases correctly, such as n = 0 and n = 1. It incorrectly returns 0 \
50
+ for n < 2 without accounting for the specific cases of full binary trees with n = 1 and n = 0 vertices.
51
+ 4. Input Validation: There is no input validation to ensure that n is a non-negative integer.
52
+ 5. Documentation: The code lacks comments and explanations, making it difficult to understand the logic and purpose \
53
+ of different sections, especially the dynamic programming part.
54
+
55
+ icl_plan: |
56
+ 1. Revise the Logic: Correct the logic for computing the number of full binary trees by using the Catalan number formula.
57
+ 2. Implement Catalan Number Calculation: Create a function to calculate the nth Catalan number using dynamic programming.
58
+ 3. Optimize the Dynamic Programming Approach: Ensure the dynamic programming approach runs with a time complexity of O(n^2) and precompute values to avoid redundant calculations.
59
+ 4. Handle Edge Cases Properly: Include conditions for n = 0 (B_0 should be 1) and n = 1 (B_1 should be 0).
60
+ 5. Validate Input: Add input validation to ensure n is a non-negative integer and raise a ValueError if the input is invalid.
61
+ 6. Add Comments and Docstrings: Include comments explaining the logic and docstrings to describe the functions and their parameters.
62
+ 7. Write Test Cases: Ensure test cases cover regular scenarios, edge cases (n = 0, n = 1), and invalid inputs.
63
+ 8. Run Tests: Verify the correctness and efficiency of the implementation by running the test cases.
64
+
65
+ icl_revised_response: |
66
+ ```python
67
+ def binomial_coefficient(n, k):
68
+ if k > n - k:
69
+ k = n - k
70
+ num = 1
71
+ for i in range(k):
72
+ num *= (n - i)
73
+ num //= (i + 1)
74
+ return num
75
+
76
+ def catalan_number(n):
77
+ if n == 0:
78
+ return 1
79
+ c = [0] * (n + 1)
80
+ c[0] = 1
81
+ for i in range(1, n + 1):
82
+ c[i] = c[i - 1] * 2 * (2 * i - 1) // (i + 1)
83
+ return c[n]
84
+
85
+ def full_binary_trees(n):
86
+ if n < 0:
87
+ raise ValueError("n must be a non-negative integer.")
88
+ if n % 2 == 0:
89
+ return 0
90
+ return catalan_number((n - 1) // 2)
91
+
92
+ # Example usage:
93
+ print(full_binary_trees(7)) # Output: 5
94
+ print(full_binary_trees(0)) # Output: 1
95
+ print(full_binary_trees(1)) # Output: 1
96
+ ```
97
+ In this implementation, `binomial_coefficient` calculates the binomial coefficient \( C(n, k) \), and `catalan_number` computes the nth Catalan number using dynamic programming. The `full_binary_trees` function then uses the Catalan number to determine the number of full binary trees with n vertices, with proper input validation and handling for edge cases.
@@ -0,0 +1,36 @@
1
+ icl_query: |
2
+ Given the following data, identify the company with the highest profit in 2021 and provide its CEO's name:
3
+ a) Company X, with CEO Amy Williams, reported $30 billion in revenue and a $3 billion profit in 2021.
4
+ b) Company Y, led by CEO Mark Thompson, posted a $60 billion revenue and a $6 billion profit in the same year.
5
+ c) Company Z, under CEO Sarah Johnson, announced a $20 billion revenue and a $7 billion profit in 2021.
6
+ d) Company W, managed by CEO James Smith, revealed a $300 billion revenue with a $21 billion profit in 2021.
7
+ e) Company V, with CEO Lisa Brown, reported a $200 billion revenue and a $25 billion profit in 2021.
8
+ f) Company U, under CEO John White, posted a $180 billion revenue and a $20 billion profit in the same year.
9
+
10
+ icl_response: The company with the highest profit in 2021 is Company E, led by CEO Lisa Brown, as it reported a profit of $25 billion.
11
+
12
+ icl_analysis: |
13
+ The task requires identifying the company with the highest profit in 2021 from a given list and then providing the name of its CEO. This is a quantitative analysis task in the domain of finance and business management. The user query demands sorting or comparing numerical values (profits) and retrieving related textual information (CEO's name). The analysis is straightforward and revolves around extracting specific data points from the provided information.
14
+
15
+ icl_rubric: |
16
+ 1. Highest Profit Identification: Accurately identify the company with the highest profit from the provided data.
17
+ 2. CEO Identification: Correctly state the name of the CEO of the identified company.
18
+ 3. Data Accuracy: Ensure the profit and revenue figures used in the identification process are correctly extracted from the provided data.
19
+ 4. Clarity and Precision: Provide a clear and precise response, explicitly naming the company and its CEO without ambiguity.
20
+ 5. Relevance: The response should focus solely on the highest profit and corresponding CEO's name, avoiding unnecessary information.
21
+
22
+ icl_critique: |
23
+ 1. Highest Profit Identification: The assistant correctly identified the company with the highest profit, which is $25 billion. However, the mislabeling of the company (referred to as Company E instead of Company V) affects the accuracy of the identification.
24
+ 2. CEO Identification: The assistant correctly names Lisa Brown as the CEO of the company with the highest profit.
25
+ 3. Data Accuracy: The profit figure of $25 billion mentioned in the response accurately matches the data provided for Company V. This shows that the assistant has correctly extracted the relevant profit figure from the data.
26
+ 4. Clarity and Precision: The response succinctly names the company and its CEO, which aligns well with the task requirements. However, the incorrect reference to "Company E" instead of "Company V" detracts from the clarity and precision of the response.
27
+ 5. Relevance: The response focuses directly on the query's requirement—identifying the company with the highest profit and its CEO's name. There is no extraneous information included, which meets the criterion of relevance effectively.
28
+
29
+ icl_plan: |
30
+ 1. Correct Company Labeling: Amend the mislabeling of "Company E" to "Company V" to ensure accuracy in company identification, satisfying the highest profit identification criterion. This correction directly addresses the first point of critique and is essential for the integrity of the response.
31
+ 2. Verification of CEO's Name: Although the CEO's name, Lisa Brown, is already correct, re-confirm this detail in the response to ensure the CEO identification criterion is indisputably met. This step also serves to double-check the data accuracy.
32
+ 3. Reinforcement of Data Accuracy: Maintain the correctly reported profit figure of $25 billion. Reinforce this by explicitly stating that this figure is the highest among all companies listed, as part of the response, thus emphasizing the data's accuracy and relevance.
33
+ 4. Enhance Clarity and Precision: Redraft the response to include a clear mention of "Company V" along with the CEO's name, removing any ambiguity caused by the earlier error. This step will not only correct the mistake but also enhance clarity and precision as required by the rubric.
34
+ 5. Maintain Relevance: Continue to focus solely on the task requirements without adding unnecessary information. The revised response should succinctly state which company had the highest profit and the name of its CEO, fulfilling the relevance criterion.
35
+
36
+ icl_revised_response: The company with the highest profit in 2021 is Company V, led by CEO Lisa Brown, with a reported profit of $25 billion.
@@ -0,0 +1,71 @@
1
+ icl_query: Provide insights into the correlation between economic indicators such as GDP, inflation, and unemployment rates. Explain how fiscal and monetary policies affect those indicators.
2
+
3
+ icl_response: |
4
+ Economic indicators such as GDP, inflation, and unemployment rates are closely interconnected and can provide valuable insights into the health of an economy.
5
+
6
+ 1. Gross Domestic Product (GDP): This is the total monetary or market value of all the finished goods and services produced within a country's borders in a specific time period. It serves as a comprehensive measure of a nation’s overall economic activity.
7
+
8
+ 2. Inflation: This refers to the rate at which the general level of prices for goods and services is rising, and subsequently, purchasing power is falling. Central banks usually aim to limit inflation, and avoid deflation, in order to keep the economy running smoothly.
9
+
10
+ 3. Unemployment Rate: This is the percentage of the labor force that is jobless, actively seeking employment, and available to take a job.
11
+
12
+ Correlation:
13
+ - There is often a negative correlation between GDP and unemployment rate. When GDP increases, the unemployment rate tends to decrease because more economic activity leads to job creation. Conversely, when GDP decreases, the unemployment rate tends to increase.
14
+ - There can be a positive correlation between inflation and GDP in the short run. This is known as demand-pull inflation, which occurs when demand for goods and services exceeds their supply. However, in the long run, the relationship between inflation and GDP can be more complex due to factors like supply shocks or changes in production costs.
15
+ - The relationship between inflation and unemployment is described by the Phillips curve, which suggests that inflation and unemployment have a stable and inverse relationship. The lower the unemployment rate, the higher the inflation rate, and vice versa. However, this relationship has been challenged by economic events such as stagflation (high inflation and high unemployment).
16
+
17
+ Fiscal Policy:
18
+ Fiscal policy involves government spending and taxation to influence the economy. When the government increases spending or decreases taxes, it can stimulate economic growth and increase GDP. This can also lead to higher employment levels and lower unemployment rates. However, if the economy is already at full employment, increased government spending and lower taxes can lead to inflationary pressures. Conversely, when the government decreases spending or increases taxes, it can slow down economic growth, decrease GDP, and potentially increase unemployment rates.
19
+
20
+ Monetary Policy:
21
+ Monetary policy involves actions by a central bank to control the supply of money, often targeting inflation and interest rates. When a central bank increases the money supply, it can lead to lower interest rates, stimulating borrowing and economic activity. This can result in higher GDP and lower unemployment rates, but it may also cause inflation to rise. Conversely, when a central bank decreases the money supply, it can lead to higher interest rates, reducing borrowing and economic activity. This can result in lower GDP, higher unemployment rates, and potentially lower inflation.
22
+
23
+ In summary, GDP, inflation, and unemployment rates are interconnected economic indicators that can be influenced by fiscal and monetary policies. Understanding these relationships can help policymakers make informed decisions to promote economic stability and growth.
24
+
25
+ icl_analysis: |
26
+ The task involves providing insights into the correlation between specific economic indicators: GDP, inflation, and unemployment rates. The domain of this task is economics, specifically focusing on macroeconomic indicators and policies. The user requests an explanation of how fiscal and monetary policies impact these indicators, indicating a need for an analysis that connects economic policies with their effects on economic health and stability.
27
+
28
+ icl_rubric: |
29
+ 1. Accuracy of Economic Relationships: The response should accurately describe the relationships between GDP, inflation, and unemployment rates, reflecting a sound understanding of economic principles.
30
+ 2. Explanation of Policy Impacts: The response must clearly explain how fiscal and monetary policies influence the economic indicators mentioned, including expected outcomes of specific policy actions.
31
+ 3. Use of Economic Terms: The response should correctly use economic terms and concepts, demonstrating proper understanding and application of economic vocabulary.
32
+ 4. Logical Flow: The explanation should be logically structured, providing a coherent narrative that connects economic indicators with policy decisions.
33
+ 5. Examples and Data: Where applicable, the response should include examples or hypothetical data to illustrate how changes in policies might affect economic indicators.
34
+
35
+ icl_critique: |
36
+ 1. Accuracy of Economic Relationships: The response effectively details the relationships between GDP, inflation, and unemployment rates, and correctly identifies how these indicators are interconnected. The explanation of the Phillips curve, demand-pull inflation, and the inverse relationship between GDP and unemployment is accurate, demonstrating a sound understanding of economic principles.
37
+ 2. Explanation of Policy Impacts: The response clearly outlines how fiscal and monetary policies affect economic indicators. It explains the direct impacts of government spending and taxation (fiscal policy) as well as central bank actions on money supply and interest rates (monetary policy) on GDP, inflation, and unemployment rates. The scenarios of increased and decreased economic activity due to policy changes are correctly described, showing a proper grasp of the policy implications on economic conditions.
38
+ 3. Use of Economic Terms: The response appropriately uses economic terms such as GDP, inflation, unemployment rate, fiscal policy, monetary policy, demand-pull inflation, and stagflation. These terms are used correctly within the context of explaining economic dynamics, demonstrating an understanding and proper application of economic vocabulary.
39
+ 4. Logical Flow: The structure of the response is logical and coherent. It begins by defining each economic indicator, then explores their interrelationships, followed by an explanation of how these are influenced by different policy decisions. This structured approach aids in understanding the complex interplay between economic indicators and policy impacts.
40
+ 5. Examples and Data: This is the area where the response could see improvement. While the theoretical explanations are strong, the response lacks specific examples or hypothetical data that could illustrate the practical impacts of policy changes on the economic indicators discussed. Including examples or case studies, such as historical instances of fiscal stimuli or monetary contractions, would enhance the response by demonstrating real-world applications of the discussed theories.
41
+
42
+ Overall, the response is well-articulated and demonstrates a robust understanding of the economic concepts. However, incorporating more practical examples or data would strengthen the connection between theoretical knowledge and real-world application.
43
+
44
+ icl_plan: |
45
+ 1. Integrate Examples and Data: Add specific historical examples and hypothetical scenarios to illustrate the impact of fiscal and monetary policies on economic indicators. For example, discuss the U.S. fiscal stimulus during the 2008 financial crisis and its effects on GDP and unemployment.
46
+ 2. Enhance Explanation of Economic Relationships: Provide a deeper explanation of the Phillips curve, discussing its limitations and the conditions under which it may not hold, such as during periods of stagflation.
47
+ 3. Clarify Policy Impact Explanations: Expand on how fiscal policies like government spending influence economic activity through mechanisms like the multiplier effect in Keynesian economics.
48
+ 4. Refine Use of Economic Terms: Include definitions or brief explanations of complex terms within the context to aid understanding, ensuring consistency and accuracy in their use.
49
+ 5. Improve Logical Flow: Introduce transitional phrases and sentences to better link sections, ensuring a seamless progression from general explanations to specific examples and from theoretical frameworks to practical applications.
50
+
51
+ icl_revised_response: |
52
+ Economic indicators such as GDP, inflation, and unemployment rates are closely interconnected, offering insights into the health of an economy.
53
+
54
+ 1. Gross Domestic Product (GDP): Represents the total market value of all final goods and services produced within a country over a specific period. It's a broad measure of overall economic activity and a primary indicator of economic health.
55
+
56
+ 2. Inflation: Measures the rate at which the general level of prices for goods and services rises, eroding purchasing power. Central banks aim to manage inflation to foster economic stability.
57
+
58
+ 3. Unemployment Rate: Indicates the percentage of the labor force that is jobless and actively seeking employment.
59
+
60
+ Correlations:
61
+ - GDP and Unemployment: Typically, an inverse relationship exists between GDP and the unemployment rate. Increased economic activity (higher GDP) often leads to job creation, lowering unemployment. Conversely, a contracting economy usually sees higher unemployment rates.
62
+ - GDP and Inflation: In the short run, GDP growth can lead to inflation if demand outstrips supply (demand-pull inflation). Over the long term, the relationship can vary due to factors like technological advances or changes in production costs.
63
+ - Inflation and Unemployment: Traditionally explained by the Phillips curve, which posits an inverse relationship between inflation and unemployment. However, the curve's reliability can falter under conditions like stagflation, where high inflation and unemployment coexist, challenging traditional economic models.
64
+
65
+ Impact of Fiscal Policy:
66
+ Fiscal policy, involving government spending and taxation, directly affects the economy. For instance, increased government spending or reduced taxes can boost economic activity, potentially raising GDP and reducing unemployment. This effect was evident during the 2008 financial crisis when U.S. fiscal stimulus aimed to revive economic growth and reduce unemployment. Conversely, reducing spending or increasing taxes can dampen economic activity, possibly leading to higher unemployment and lower GDP.
67
+
68
+ Impact of Monetary Policy:
69
+ Monetary policy, governed by central bank actions, primarily targets money supply and interest rates. An increase in the money supply can lower interest rates, encouraging borrowing and investment, boosting GDP, and reducing unemployment. However, this can also lead to higher inflation. On the other hand, reducing the money supply can increase interest rates, slowing economic activity, which could lower inflation but increase unemployment rates.
70
+
71
+ In summary, GDP, inflation, and unemployment are interlinked economic indicators influenced significantly by fiscal and monetary policies. Understanding these relationships and the effects of policy tools is crucial for effective economic management and achieving stable growth.