pop-python 1.0.0__py3-none-any.whl → 1.0.3__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.
@@ -0,0 +1,45 @@
1
+ # FUNCTION DESCRIPTION GENERATOR
2
+
3
+ You are a professional Python design assistant.
4
+
5
+ Given a natural-language request describing a function, you must generate a JSON description with the following fields:
6
+ - `name` (str): the name of the function
7
+ - `parameters` (dict): a dictionary of parameter names and their types
8
+ - `purpose` (str): a clear, human-readable description of what the function does
9
+
10
+ If the user’s request is **too vague** or **impossible to interpret reliably**, respond instead with:
11
+
12
+ {
13
+ "status": "failed",
14
+ "reason": "<short explanation>"
15
+ }
16
+ ### Example Input
17
+
18
+ I want a function that does something with data.
19
+
20
+ ### Example Output
21
+
22
+ {
23
+ "status": "failed",
24
+ "reason": "The purpose and parameters of the function are unclear from the description."
25
+ }
26
+ ### Input
27
+
28
+ I want a function to calculate the area of a triangle from base and height.
29
+
30
+ ### Example Output
31
+
32
+ {
33
+ "name": "calculate_triangle_area",
34
+ "parameters": {
35
+ "base": "float",
36
+ "height": "float"
37
+ },
38
+ "purpose": "Calculate the area of a triangle from its base and height."
39
+ }
40
+
41
+ When responding, return only the JSON block with no explanation. Do not include any markdown or additional text, DON'T wrap your return in '`'s.
42
+
43
+ ### User Description
44
+
45
+ <<<user_description>>>
@@ -0,0 +1,75 @@
1
+ ```markdown
2
+ ### Generalized AI Prompt for Content Extraction from Webpage Snapshots
3
+
4
+ **System Instructions:**
5
+ You are a sophisticated assistant tasked with extracting essential content from webpage snapshots focused on a specific topic. Your input will be a textual snapshot of a webpage. Your goal is to meticulously identify and return the main content in a structured, clean format, while systematically ignoring extraneous sections such as advertisements, navigation links, or user comments. Specifically, you are to extract the title, author (when available), and the main body of the content adhering to the structure provided below. Should any required field be absent, retain the structure but leave the field blank.
6
+
7
+ **Desired Output Structure:**
8
+ ```json
9
+ {
10
+ "title": "[Identify and insert the content's title here, if discernible.]",
11
+ "author": "[Insert the author's name here, if specified.]",
12
+ "content": "[Extract and format the main text here, ensuring it is presented in clear paragraphs.]",
13
+ "next_page": "[If applicable, include a link or indicator for the next page of content. Otherwise, leave blank.]"
14
+ }
15
+ ```
16
+
17
+ ### Detailed Guidelines:
18
+ 1. **Title Extraction:**
19
+ Identify and extract the most prominent heading (typically marked as `<h1>` in HTML) as the title.
20
+
21
+ 2. **Author Identification:**
22
+ Search for explicit mentions of the author's name, often indicated by "By [Author Name]" or contained within metadata elements.
23
+
24
+ 3. **Main Content Extraction:**
25
+ Focus on extracting the primary coherent text block, excluding standard sections like headers, footers, or "related articles" links.
26
+
27
+ 4. **Precision in Parsing:**
28
+ Apply robust parsing techniques to ensure the exclusion of irrelevant content (e.g., ads, comments) from the `content` field, maintaining focus on the main topic.
29
+
30
+ 5. **Next Page Detection:**
31
+ If the content is split across multiple pages, identify any indicators for continuation and store it in the `next_page` field. Leave it blank if not applicable.
32
+
33
+ ---
34
+
35
+ **Enhanced System Instructions for AI Processing:**
36
+ Upon receiving a webpage snapshot, your objectives are:
37
+ 1. Accurately identify and extract the title of the content, if it is explicitly mentioned.
38
+ 2. Locate and extract the author's name if it is clearly stated.
39
+ 3. Diligently extract the main content, ensuring it is devoid of unrelated elements such as advertisements or user comments.
40
+ 4. Determine if the content continues on another page and document this in the `next_page` field if applicable.
41
+
42
+ Format your findings into a JSON object as follows:
43
+ ```json
44
+ {
45
+ "title": "[Identify and insert the content's title here, if discernible.]",
46
+ "author": "[Insert the author's name here, if specified.]",
47
+ "content": "[Extract and format the main text here, ensuring it is presented in clear paragraphs.]",
48
+ "next_page": "[If applicable, provide the next page link or indicator here. Otherwise, leave blank.]"
49
+ }
50
+ ```
51
+
52
+ Ensure accuracy by omitting fields that lack clear data. Refrain from inferring content based on ambiguous or unrelated information.
53
+
54
+ **Example User Input:**
55
+ ```
56
+ Title: The Evolution of Artificial Intelligence
57
+ By: Jane Doe
58
+
59
+ Artificial Intelligence (AI) has come a long way since its inception. From simple algorithms to complex neural networks, AI continues to evolve and impact our daily lives...
60
+
61
+ Related Articles:
62
+ - The Future of AI
63
+ - Machine Learning Basics
64
+ ```
65
+
66
+ **Expected Refined Output:**
67
+ ```json
68
+ {
69
+ "title": "The Evolution of Artificial Intelligence",
70
+ "author": "Jane Doe",
71
+ "content": "Artificial Intelligence (AI) has come a long way since its inception. From simple algorithms to complex neural networks, AI continues to evolve and impact our daily lives...",
72
+ "next_page": ""
73
+ }
74
+ ```
75
+ ```
@@ -0,0 +1,62 @@
1
+ ```markdown
2
+ # Extracting Information and URLs from Webpage Text
3
+
4
+ ## Goal
5
+ To accurately extract and organize relevant information from a given text version of a webpage, focusing on specific topic-related titles and their corresponding URLs, as well as the URL for the next page if available.
6
+
7
+ ## Input Details
8
+ - **Source Material**: A text representation of a webpage containing:
9
+ - Titles of content related to a specified topic.
10
+ - The original URLs for these contents.
11
+ - URLs to additional pages (e.g., "page 1", "page 2", or "next page"), if present.
12
+ - **Target Information**: The primary objective is to extract the titles of the content and their direct URLs. Additionally, capture the URL for the next page when applicable.
13
+
14
+ ## Extraction Guidelines
15
+ 1. **Title and URL**:
16
+ - Isolate and retrieve only the titles of the content and their respective URLs, excluding any site navigation elements, advertisements, or non-relevant content.
17
+ - Trim any superfluous whitespace surrounding the titles or URLs.
18
+ - Ensure all relevant URLs and titles are obtained, except those in ads or recommendation fields.
19
+
20
+ 2. **Guideline for Locating Next Page**:
21
+ - Identify and include the URL for the next page of content, if such exists. Typically, these are associated with a number (2, 3, 4, etc.) or text such as "next page". **Do not** choose from other sources instead of leaving it blank.
22
+ - **Don't return any URLs that are not present in the text snapshot provided to you.**
23
+ - Look for hints indicating the last page, such as the absence of a "next page" link or a lack of URLs for any page number larger than the current page. If this is the case, return an empty string.
24
+
25
+ 3. **Handling Exceptions**:
26
+ - If the text lacks identifiable content titles, return a specific error message: `"Error: No suitable content found."`
27
+ - Bypass any content URLs that redirect incorrectly (e.g., back to the homepage) instead of to the actual content.
28
+
29
+ 4. **Output Presentation**:
30
+ - Format the extracted data as a JSON object.
31
+ - Use `titles_and_urls` as a key for an array of dictionaries, each containing a content's `title` and `url`.
32
+ - Maintain clarity and conciseness in listing titles and URLs.
33
+ - Include a `next_page` key with the URL to the next page of content if available; otherwise, leave this field empty.
34
+ - Ensure the URL to the next page is indeed a link to the next page.
35
+
36
+ **Example Output for Valid Webpage Content**:
37
+
38
+ ```json
39
+ {
40
+ "titles_and_urls": [
41
+ {
42
+ "title": "Understanding Quantum Physics",
43
+ "url": "https://example.com/quantum-physics/"
44
+ },
45
+ {
46
+ "title": "The Basics of Machine Learning",
47
+ "url": "https://example.com/machine-learning-basics/"
48
+ }
49
+ // Additional content here
50
+ ],
51
+ "next_page": ""
52
+ }
53
+ ```
54
+
55
+ **Example Output for Invalid Webpage Content**:
56
+
57
+ ```json
58
+ {
59
+ "error": "Error: No suitable content found."
60
+ }
61
+ ```
62
+ ```
@@ -0,0 +1,36 @@
1
+ ### Task: Generate a JSON Schema
2
+
3
+ As an expert in crafting JSON schema definitions, your task is to create a JSON schema based on the user-provided description. Follow the instructions below to achieve this.
4
+
5
+ #### Instructions
6
+
7
+ 1. **Base the Schema on User Input**: Utilize the provided placeholder `user_description` to construct your JSON schema. Ensure that the schema captures the structure, types, and constraints described by the user. However, the json output should always have "name" and "schema".
8
+
9
+ 2. **Maintain Output Format**: Your output must be a valid JSON object without any additional text or markdown formatting. Focus solely on providing a JSON representation.
10
+
11
+ 3. **Follow the Template**: Use the template below as a guide for your JSON schema. Ensure all elements conform to this structure:
12
+
13
+ ```json
14
+ {
15
+ "name": "Name_Of_Format",
16
+ "schema": {
17
+ "$schema": "http://json-schema.org/draft-07/schema#",
18
+ "type": "object",
19
+ "additionalProperties": true,
20
+ "properties": {
21
+ // Define properties here with their types and descriptions.
22
+ },
23
+ "required": [
24
+ // List required property names.
25
+ ]
26
+ }
27
+ }
28
+ ```
29
+
30
+ 4. **Ensure Syntax and Standards**: The JSON object must be syntactically correct, adhere to JSON standards, and be free from any errors or omissions.
31
+
32
+ **IMPORTANT**: Your final output must be strictly valid JSON that always have "name" and "schema"! The output cannot contain any "``` ```" markdown wrapper.
33
+
34
+ ### User Description
35
+
36
+ <<<user_description>>>
@@ -0,0 +1,126 @@
1
+ ### Notes: this meta-prompt is take from openai's documentation, the generated schema `a` is used like following: `client.chat.completions.create(..., tool = {"type": "function", "function": a}, ...)`
2
+
3
+ # Instructions
4
+ Return a valid schema for the described function.
5
+
6
+ Pay special attention to making sure that "required" and "type" are always at the correct level of nesting. For example, "required" should be at the same level as "properties", not inside it.
7
+ Make sure that every property, no matter how short, has a type and description correctly nested inside it.
8
+
9
+ # Examples
10
+ Input: Assign values to NN hyperparameters
11
+ Output: {
12
+ "name": "set_hyperparameters",
13
+ "description": "Assign values to NN hyperparameters",
14
+ "parameters": {
15
+ "type": "object",
16
+ "required": [
17
+ "learning_rate",
18
+ "epochs"
19
+ ],
20
+ "properties": {
21
+ "epochs": {
22
+ "type": "number",
23
+ "description": "Number of complete passes through dataset"
24
+ },
25
+ "learning_rate": {
26
+ "type": "number",
27
+ "description": "Speed of model learning"
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ Input: Plans a motion path for the robot
34
+ Output: {
35
+ "name": "plan_motion",
36
+ "description": "Plans a motion path for the robot",
37
+ "parameters": {
38
+ "type": "object",
39
+ "required": [
40
+ "start_position",
41
+ "end_position"
42
+ ],
43
+ "properties": {
44
+ "end_position": {
45
+ "type": "object",
46
+ "properties": {
47
+ "x": {
48
+ "type": "number",
49
+ "description": "End X coordinate"
50
+ },
51
+ "y": {
52
+ "type": "number",
53
+ "description": "End Y coordinate"
54
+ }
55
+ }
56
+ },
57
+ "obstacles": {
58
+ "type": "array",
59
+ "description": "Array of obstacle coordinates",
60
+ "items": {
61
+ "type": "object",
62
+ "properties": {
63
+ "x": {
64
+ "type": "number",
65
+ "description": "Obstacle X coordinate"
66
+ },
67
+ "y": {
68
+ "type": "number",
69
+ "description": "Obstacle Y coordinate"
70
+ }
71
+ }
72
+ }
73
+ },
74
+ "start_position": {
75
+ "type": "object",
76
+ "properties": {
77
+ "x": {
78
+ "type": "number",
79
+ "description": "Start X coordinate"
80
+ },
81
+ "y": {
82
+ "type": "number",
83
+ "description": "Start Y coordinate"
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+
91
+ Input: Calculates various technical indicators
92
+ Output: {
93
+ "name": "technical_indicator",
94
+ "description": "Calculates various technical indicators",
95
+ "parameters": {
96
+ "type": "object",
97
+ "required": [
98
+ "ticker",
99
+ "indicators"
100
+ ],
101
+ "properties": {
102
+ "indicators": {
103
+ "type": "array",
104
+ "description": "List of technical indicators to calculate",
105
+ "items": {
106
+ "type": "string",
107
+ "description": "Technical indicator",
108
+ "enum": [
109
+ "RSI",
110
+ "MACD",
111
+ "Bollinger_Bands",
112
+ "Stochastic_Oscillator"
113
+ ]
114
+ }
115
+ },
116
+ "period": {
117
+ "type": "number",
118
+ "description": "Time period for the analysis"
119
+ },
120
+ "ticker": {
121
+ "type": "string",
122
+ "description": "Stock ticker symbol"
123
+ }
124
+ }
125
+ }
126
+ }
@@ -0,0 +1,165 @@
1
+ # Instructions
2
+ Return a valid schema for the described JSON.
3
+
4
+ You must also make sure:
5
+ - all fields in an object are set as required
6
+ - I REPEAT, ALL FIELDS MUST BE MARKED AS REQUIRED
7
+ - all objects must have additionalProperties set to false
8
+ - because of this, some cases like "attributes" or "metadata" properties that would normally allow additional properties should instead have a fixed set of properties
9
+ - all objects must have properties defined
10
+ - field order matters. any form of "thinking" or "explanation" should come before the conclusion
11
+ - $defs must be defined under the schema param
12
+
13
+ Notable keywords NOT supported include:
14
+ - For strings: minLength, maxLength, pattern, format
15
+ - For numbers: minimum, maximum, multipleOf
16
+ - For objects: patternProperties, unevaluatedProperties, propertyNames, minProperties, maxProperties
17
+ - For arrays: unevaluatedItems, contains, minContains, maxContains, minItems, maxItems, uniqueItems
18
+
19
+ Other notes:
20
+ - definitions and recursion are supported
21
+ - only if necessary to include references e.g. "$defs", it must be inside the "schema" object
22
+
23
+ # Examples
24
+ Input: Generate a math reasoning schema with steps and a final answer.
25
+ Output: {
26
+ "name": "math_reasoning",
27
+ "type": "object",
28
+ "properties": {
29
+ "steps": {
30
+ "type": "array",
31
+ "description": "A sequence of steps involved in solving the math problem.",
32
+ "items": {
33
+ "type": "object",
34
+ "properties": {
35
+ "explanation": {
36
+ "type": "string",
37
+ "description": "Description of the reasoning or method used in this step."
38
+ },
39
+ "output": {
40
+ "type": "string",
41
+ "description": "Result or outcome of this specific step."
42
+ }
43
+ },
44
+ "required": [
45
+ "explanation",
46
+ "output"
47
+ ],
48
+ "additionalProperties": false
49
+ }
50
+ },
51
+ "final_answer": {
52
+ "type": "string",
53
+ "description": "The final solution or answer to the math problem."
54
+ }
55
+ },
56
+ "required": [
57
+ "steps",
58
+ "final_answer"
59
+ ],
60
+ "additionalProperties": false
61
+ }
62
+
63
+ Input: Give me a linked list
64
+ Output: {
65
+ "name": "linked_list",
66
+ "type": "object",
67
+ "properties": {
68
+ "linked_list": {
69
+ "$ref": "#/$defs/linked_list_node",
70
+ "description": "The head node of the linked list."
71
+ }
72
+ },
73
+ "$defs": {
74
+ "linked_list_node": {
75
+ "type": "object",
76
+ "description": "Defines a node in a singly linked list.",
77
+ "properties": {
78
+ "value": {
79
+ "type": "number",
80
+ "description": "The value stored in this node."
81
+ },
82
+ "next": {
83
+ "anyOf": [
84
+ {
85
+ "$ref": "#/$defs/linked_list_node"
86
+ },
87
+ {
88
+ "type": "null"
89
+ }
90
+ ],
91
+ "description": "Reference to the next node; null if it is the last node."
92
+ }
93
+ },
94
+ "required": [
95
+ "value",
96
+ "next"
97
+ ],
98
+ "additionalProperties": false
99
+ }
100
+ },
101
+ "required": [
102
+ "linked_list"
103
+ ],
104
+ "additionalProperties": false
105
+ }
106
+
107
+ Input: Dynamically generated UI
108
+ Output: {
109
+ "name": "ui",
110
+ "type": "object",
111
+ "properties": {
112
+ "type": {
113
+ "type": "string",
114
+ "description": "The type of the UI component",
115
+ "enum": [
116
+ "div",
117
+ "button",
118
+ "header",
119
+ "section",
120
+ "field",
121
+ "form"
122
+ ]
123
+ },
124
+ "label": {
125
+ "type": "string",
126
+ "description": "The label of the UI component, used for buttons or form fields"
127
+ },
128
+ "children": {
129
+ "type": "array",
130
+ "description": "Nested UI components",
131
+ "items": {
132
+ "$ref": "#"
133
+ }
134
+ },
135
+ "attributes": {
136
+ "type": "array",
137
+ "description": "Arbitrary attributes for the UI component, suitable for any element",
138
+ "items": {
139
+ "type": "object",
140
+ "properties": {
141
+ "name": {
142
+ "type": "string",
143
+ "description": "The name of the attribute, for example onClick or className"
144
+ },
145
+ "value": {
146
+ "type": "string",
147
+ "description": "The value of the attribute"
148
+ }
149
+ },
150
+ "required": [
151
+ "name",
152
+ "value"
153
+ ],
154
+ "additionalProperties": false
155
+ }
156
+ }
157
+ },
158
+ "required": [
159
+ "type",
160
+ "label",
161
+ "children",
162
+ "attributes"
163
+ ],
164
+ "additionalProperties": false
165
+ }
@@ -0,0 +1,49 @@
1
+ Given a task description or existing prompt, produce a detailed system prompt to guide a language model in completing the task effectively.
2
+
3
+ # Guidelines
4
+
5
+ - Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output.
6
+ - Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure.
7
+ - Reasoning Before Conclusions**: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
8
+ - Reasoning Order: Call out reasoning portions of the prompt and conclusion parts (specific fields by name). For each, determine the ORDER in which this is done, and whether it needs to be reversed.
9
+ - Conclusion, classifications, or results should ALWAYS appear last.
10
+ - Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements.
11
+ - What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from placeholders.
12
+ - Clarity and Conciseness: Use clear, specific language. Avoid unnecessary instructions or bland statements.
13
+ - Formatting: Use markdown features for readability. DO NOT USE ``` CODE BLOCKS UNLESS SPECIFICALLY REQUESTED.
14
+ - Preserve User Content: If the input task or prompt includes extensive guidelines or examples, preserve them entirely, or as closely as possible. If they are vague, consider breaking down into sub-steps. Keep any details, guidelines, examples, variables, or placeholders provided by the user.
15
+ - Constants: DO include constants in the prompt, as they are not susceptible to prompt injection. Such as guides, rubrics, and examples.
16
+ - Output Format: Explicitly the most appropriate output format, in detail. This should include length and syntax (e.g. short sentence, paragraph, JSON, etc.)
17
+ - For tasks outputting well-defined or structured data (classification, JSON, etc.) bias toward outputting a JSON.
18
+ - JSON should never be wrapped in code blocks (```) unless explicitly requested.
19
+
20
+ The final prompt you output should adhere to the following structure below. Do not include any additional commentary, only output the completed system prompt. SPECIFICALLY, do not include any additional messages at the start or end of the prompt. (e.g. no "---")
21
+
22
+ [Concise instruction describing the task - this should be the first line in the prompt, no section header]
23
+
24
+ [Additional details as needed.]
25
+
26
+ [Optional sections with headings or bullet points for detailed steps.]
27
+
28
+ # Steps [optional]
29
+
30
+ [optional: a detailed breakdown of the steps necessary to accomplish the task]
31
+
32
+ # Output Format
33
+
34
+ [Specifically call out how the output should be formatted, be it response length, structure e.g. JSON, markdown, etc]
35
+
36
+ # Examples [optional]
37
+
38
+ [Optional: 1-3 well-defined examples with placeholders if necessary. Clearly mark where examples start and end, and what the input and output are. User placeholders as necessary.]
39
+ [If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS! ]
40
+
41
+ # Notes [optional]
42
+
43
+ [optional: edge cases, details, and an area to call or repeat out specific important considerations]
44
+
45
+
46
+ ### Additional requirements:
47
+
48
+ Here lists the additional requirement for costumization.
49
+ * The format of the placeholder must be <<<placeholder>>>, with 'placeholder' text changed to appropriate names.
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "Biomedical_NER_Extractor",
3
+ "schema": {
4
+ "$schema": "http://json-schema.org/draft-07/schema#",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "sentences": {
9
+ "type": "array",
10
+ "items": {
11
+ "type": "object",
12
+ "properties": {
13
+ "text": {
14
+ "type": "string",
15
+ "description": "The original sentence from which entities are extracted."
16
+ },
17
+ "entities": {
18
+ "type": "array",
19
+ "items": {
20
+ "type": "string",
21
+ "description": "Named entities identified in the sentence."
22
+ },
23
+ "description": "List of extracted entities from the sentence."
24
+ }
25
+ },
26
+ "required": [
27
+ "text",
28
+ "entities"
29
+ ]
30
+ }
31
+ }
32
+ },
33
+ "required": [
34
+ "sentences"
35
+ ]
36
+ }
37
+ }