diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..602d0e7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,37 @@ +name: Bug Report +description: File a bug report. +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you see! + value: "I was doing THIS, when THAT happened. I was expecting THAT_OTHER_THING to happen instead." + validations: + required: true + - type: checkboxes + id: version + attributes: + label: Version check + description: Please make sure you were using the latest version of this project available in the `main` branch. + options: + - label: Yes I was. + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: textarea + id: screens + attributes: + label: Relevant screenshots (optional) + description: Please upload any screenshots that may help us reproduce and/or understand the issue. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..7510ea1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,13 @@ +name: Feature Request +description: Suggest features for this project. +title: "[Feature request]: " +labels: ["enhancement"] +body: + - type: textarea + id: description + attributes: + label: What do you need? + description: Tell us what functionality you would like added/modified? + value: "I want the CLI to do my homework for me." + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 0000000..1c201e1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,12 @@ +name: Question +description: Ask us questions about this project. +title: "[Question]: " +labels: ["question"] +body: + - type: textarea + id: description + attributes: + label: What is your question? + value: "After reading the documentation, I am still not clear how to get X working. I tried this, this, and that." + validations: + required: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..90e8adc --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,9 @@ +## What this Pull Request (PR) does +Please briefly describe what this PR does. + +## Related issues +Please reference any open issues this PR relates to in here. +If it closes an issue, type `closes #[ISSUE_NUMBER]`. + +## Screenshots +Provide any screenshots you may find relevant to facilitate us understanding your PR. diff --git a/README.md b/README.md index 0110518..64aa8ac 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ Fabric has Patterns for all sorts of life and work activities, including: - Getting summaries of long, boring content - Explaining code to you - Turning bad documentation into usable documentation -- Create social media posts from any content input +- Creating social media posts from any content input - And a million more… ### Our approach to prompting diff --git a/installer/client/cli/README.md b/installer/client/cli/README.md index d2f9219..c512e84 100644 --- a/installer/client/cli/README.md +++ b/installer/client/cli/README.md @@ -32,7 +32,8 @@ Options include: --pattern, -p: Select the module for analysis. --stream, -s: Stream output to another application. --output, -o: Save the response to a file. ---copy, -c: Copy the response to the clipboard. +--copy, -C: Copy the response to the clipboard. +--context, -c: Use Context file (context.md) to add context to your pattern Example: diff --git a/installer/client/cli/context.md b/installer/client/cli/context.md new file mode 100644 index 0000000..4a7052a --- /dev/null +++ b/installer/client/cli/context.md @@ -0,0 +1,3 @@ +# Context + +please give all responses in spanish diff --git a/installer/client/cli/fabric.py b/installer/client/cli/fabric.py index 315ef78..0ddc79c 100755 --- a/installer/client/cli/fabric.py +++ b/installer/client/cli/fabric.py @@ -6,13 +6,14 @@ import os script_directory = os.path.dirname(os.path.realpath(__file__)) + def main(): parser = argparse.ArgumentParser( description="An open source framework for augmenting humans using AI." ) parser.add_argument("--text", "-t", help="Text to extract summary from") parser.add_argument( - "--copy", "-c", help="Copy the response to the clipboard", action="store_true" + "--copy", "-C", help="Copy the response to the clipboard", action="store_true" ) parser.add_argument( "--output", @@ -31,7 +32,8 @@ def main(): parser.add_argument( "--list", "-l", help="List available patterns", action="store_true" ) - parser.add_argument("--update", "-u", help="Update patterns", action="store_true") + parser.add_argument( + "--update", "-u", help="Update patterns", action="store_true") parser.add_argument("--pattern", "-p", help="The pattern (prompt) to use") parser.add_argument( "--setup", help="Set up your fabric instance", action="store_true" @@ -42,11 +44,14 @@ def main(): parser.add_argument( "--listmodels", help="List all available models", action="store_true" ) + parser.add_argument('--context', '-c', + help="Use Context file (context.md) to add context to your pattern", action="store_true") args = parser.parse_args() home_holder = os.path.expanduser("~") config = os.path.join(home_holder, ".config", "fabric") config_patterns_directory = os.path.join(config, "patterns") + config_context = os.path.join(config, "context.md") env_file = os.path.join(config, ".env") if not os.path.exists(config): os.makedirs(config) @@ -63,6 +68,10 @@ def main(): Update() print("Your Patterns have been updated.") sys.exit() + if args.context: + if not os.path.exists(os.path.join(config, "context.md")): + print("Please create a context.md file in ~/.config/fabric") + sys.exit() standalone = Standalone(args, args.pattern) if args.list: try: @@ -80,10 +89,19 @@ def main(): text = args.text else: text = standalone.get_cli_input() - if args.stream: + if args.stream and not args.context: standalone.streamMessage(text) + if args.stream and args.context: + with open(config_context, "r") as f: + context = f.read() + standalone.streamMessage(text, context=context) + elif args.context: + with open(config_context, "r") as f: + context = f.read() + standalone.sendMessage(text, context=context) else: standalone.sendMessage(text) + if __name__ == "__main__": main() diff --git a/installer/client/cli/utils.py b/installer/client/cli/utils.py index 61a7dd6..42255d5 100644 --- a/installer/client/cli/utils.py +++ b/installer/client/cli/utils.py @@ -13,7 +13,6 @@ config_directory = os.path.expanduser("~/.config/fabric") env_file = os.path.join(config_directory, ".env") - class Standalone: def __init__(self, args, pattern="", env_file="~/.config/fabric/.env"): """ Initialize the class with the provided arguments and environment file. @@ -55,7 +54,7 @@ class Standalone: print(f"An error occurred: {e}") sys.exit() - def streamMessage(self, input_data: str): + def streamMessage(self, input_data: str, context=""): """ Stream a message and handle exceptions. Args: @@ -77,14 +76,21 @@ class Standalone: if self.pattern: try: with open(wisdom_File, "r") as f: - system = f.read() + if context: + system = context + '\n\n' + f.read() + else: + system = f.read() system_message = {"role": "system", "content": system} messages = [system_message, user_message] except FileNotFoundError: print("pattern not found") return else: - messages = [user_message] + if context: + user_message += {role: "system", content: context} + messages = [user_message] + else: + messages = [user_message] try: arguments = { "model": self.model, @@ -117,7 +123,7 @@ class Standalone: with open(self.args.output, "w") as f: f.write(buffer) - def sendMessage(self, input_data: str): + def sendMessage(self, input_data: str, context=""): """ Send a message using the input data and generate a response. Args: @@ -138,14 +144,21 @@ class Standalone: if self.pattern: try: with open(wisdom_File, "r") as f: - system = f.read() + if context: + system = context + '\n\n' + f.read() + else: + system = f.read() system_message = {"role": "system", "content": system} messages = [system_message, user_message] except FileNotFoundError: print("pattern not found") return else: - messages = [user_message] + if context: + user_message += {'role': 'system', 'content': context} + messages = [user_message] + else: + messages = [user_message] try: arguments = { "model": self.model, @@ -171,7 +184,7 @@ class Standalone: headers = { "Authorization": f"Bearer { os.environ.get('OPENAI_API_KEY') }" } - + response = requests.get("https://api.openai.com/v1/models", headers=headers) if response.status_code == 200: @@ -180,17 +193,17 @@ class Standalone: gpt_models = [model for model in models if model.get("id", "").startswith(("gpt"))] # Sort the models alphabetically by their ID sorted_gpt_models = sorted(gpt_models, key=lambda x: x.get("id")) - + for model in sorted_gpt_models: print(model.get("id")) else: print(f"Failed to fetch models: HTTP {response.status_code}") - + def get_cli_input(self): """ aided by ChatGPT; uses platform library accepts either piped input or console input from either Windows or Linux - + Args: none Returns: @@ -201,7 +214,8 @@ class Standalone: if not sys.stdin.isatty(): # Check if input is being piped return sys.stdin.read().strip() # Read piped input else: - return input("Enter Question: ") # Prompt user for input from console + # Prompt user for input from console + return input("Enter Question: ") else: return sys.stdin.read() @@ -380,25 +394,25 @@ class Setup: self.api_key(apikey.strip()) self.patterns() - + class Transcribe: def youtube(video_id): """ This method gets the transciption of a YouTube video designated with the video_id - + Input: the video id specifing a YouTube video an example url for a video: https://www.youtube.com/watch?v=vF-MQmVxnCs&t=306s the video id is vF-MQmVxnCs&t=306s - + Output: a transcript for the video - + Raises: an exception and prints error - - + + """ try: transcript_list = YouTubeTranscriptApi.get_transcript(video_id) @@ -409,5 +423,4 @@ class Transcribe: except Exception as e: print("Error:", e) return None - - + \ No newline at end of file diff --git a/patterns/.DS_Store b/patterns/.DS_Store deleted file mode 100644 index 630ca07..0000000 Binary files a/patterns/.DS_Store and /dev/null differ diff --git a/patterns/analyze_paper/system.md b/patterns/analyze_paper/system.md index b42c0a7..77ba384 100644 --- a/patterns/analyze_paper/system.md +++ b/patterns/analyze_paper/system.md @@ -6,58 +6,37 @@ Take a deep breath and think step by step about how to best accomplish this goal # OUTPUT SECTIONS -- Extract a summary of the content in 50 words or less, including who is presenting and the content being discussed into a section called SUMMARY. +- Extract a summary of the paper and its conclusions in into a 25-word sentence called SUMMARY. - Extract the list of authors in a section called AUTHORS. - Extract the list of organizations the authors are associated, e.g., which university they're at, with in a section called AUTHOR ORGANIZATIONS. -- Extract the primary paper findings into a bulleted list of no more than 50 words per bullet into a section called FINDINGS. +- Extract the primary paper findings into a bulleted list of no more than 25 words per bullet into a section called FINDINGS. -- You extract the size and details of the study for the research in a section called STUDY DETAILS. +- Extract the overall structure and character of the study for the research in a section called STUDY DETAILS. -- Extract the study quality by evaluating the following items in a section called STUDY QUALITY: +- Extract the study quality by evaluating the following items in a section called STUDY QUALITY that has the following sub-sections: -### Sample size +- Study Design: (give a 25 word description, including the pertinent data and statistics.) +- Sample Size: (give a 25 word description, including the pertinent data and statistics.) +- Confidence Intervals (give a 25 word description, including the pertinent data and statistics.) +- P-value (give a 25 word description, including the pertinent data and statistics.) +- Effect Size (give a 25 word description, including the pertinent data and statistics.) +- Consistency of Results (give a 25 word description, including the pertinent data and statistics.) +- Data Analysis Method (give a 25 word description, including the pertinent data and statistics.) -- **Check the Sample Size**: The larger the sample size, the more confident you can be in the findings. A larger sample size reduces the margin of error and increases the study's power. +- Discuss any Conflicts of Interest in a section called CONFLICTS OF INTEREST. Rate the conflicts of interest as NONE DETECTED, LOW, MEDIUM, HIGH, or CRITICAL. -### Confidence intervals +- Extract the researcher's analysis and interpretation in a section called RESEARCHER'S INTERPRETATION, including how confident they are in the results being real and likely to be replicated on a scale of LOW, MEDIUM, or HIGH. -- **Look at the Confidence Intervals**: Confidence intervals provide a range within which the true population parameter lies with a certain degree of confidence (usually 95% or 99%). Narrower confidence intervals suggest a higher level of precision and confidence in the estimate. - -### P-Value - -- **Evaluate the P-value**: The P-value tells you the probability that the results occurred by chance. A lower P-value (typically less than 0.05) suggests that the findings are statistically significant and not due to random chance. - -### Effect size - -- **Consider the Effect Size**: Effect size tells you how much of a difference there is between groups. A larger effect size indicates a stronger relationship and more confidence in the findings. - -### Study design - -- **Review the Study Design**: Randomized controlled trials are usually considered the gold standard in research. If the study is observational, it may be less reliable. - -### Consistency of results - -- **Check for Consistency of Results**: If the results are consistent across multiple studies, it increases the confidence in the findings. - -### Data analysis methods - -- **Examine the Data Analysis Methods**: Check if the data analysis methods used are appropriate for the type of data and research question. Misuse of statistical methods can lead to incorrect conclusions. - -### Researcher's interpretation - -- **Assess the Researcher's Interpretation**: The researchers should interpret their results in the context of the study's limitations. Overstating the findings can misrepresent the confidence level. - -### Summary - -You output a 50 word summary of the quality of the paper and it's likelihood of being replicated in future work as one of three levels: High, Medium, or Low. You put that sentence and ratign into a section called SUMMARY. +- Based on all of the analysis performed above, output a 25 word summary of the quality of the paper and it's likelihood of being replicated in future work as one of five levels: VERY LOW, LOW, MEDIUM, HIGH, or VERY HIGH. You put that sentence and RATING into a section called SUMMARY and RATING. # OUTPUT INSTRUCTIONS - Create the output using the formatting above. - You only output human readable Markdown. +- In the markdown, don't use formatting like bold or italics. Make the output maximially readable in plain text. - Do not output warnings or notes—just the requested sections. # INPUT: diff --git a/patterns/extract_article_wisdom/README.md b/patterns/extract_article_wisdom/README.md new file mode 100644 index 0000000..1c45a35 --- /dev/null +++ b/patterns/extract_article_wisdom/README.md @@ -0,0 +1,154 @@ +
extractwisdom
is a Fabric pattern that extracts wisdom from any text.