├── .gitignore ├── License.txt ├── app ├── prompt_templates.py └── question_framing.py ├── flowchart.mmd ├── main.py ├── packages ├── chains.py └── prompts.py ├── readme.md ├── readme ├── researchplot_logo.png └── researchplot_output.png └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Editors 2 | .vscode/ 3 | .idea/ 4 | 5 | # Vagrant 6 | .vagrant/ 7 | 8 | # Mac/OSX 9 | .DS_Store 10 | 11 | # Windows 12 | Thumbs.db 13 | 14 | # Source for the following rules: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore 15 | # Byte-compiled / optimized / DLL files 16 | __pycache__/ 17 | *.py[cod] 18 | *$py.class 19 | 20 | # C extensions 21 | *.so 22 | 23 | # Distribution / packaging 24 | .Python 25 | build/ 26 | develop-eggs/ 27 | dist/ 28 | downloads/ 29 | eggs/ 30 | .eggs/ 31 | lib/ 32 | lib64/ 33 | parts/ 34 | sdist/ 35 | var/ 36 | wheels/ 37 | *.egg-info/ 38 | .installed.cfg 39 | *.egg 40 | MANIFEST 41 | 42 | # PyInstaller 43 | # Usually these files are written by a python script from a template 44 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 45 | *.manifest 46 | *.spec 47 | 48 | # Installer logs 49 | pip-log.txt 50 | pip-delete-this-directory.txt 51 | 52 | # Unit test / coverage reports 53 | htmlcov/ 54 | .tox/ 55 | .nox/ 56 | .coverage 57 | .coverage.* 58 | .cache 59 | nosetests.xml 60 | coverage.xml 61 | *.cover 62 | .hypothesis/ 63 | .pytest_cache/ 64 | 65 | # Translations 66 | *.mo 67 | *.pot 68 | 69 | # Django stuff: 70 | *.log 71 | local_settings.py 72 | db.sqlite3 73 | 74 | # Flask stuff: 75 | instance/ 76 | .webassets-cache 77 | 78 | # Scrapy stuff: 79 | .scrapy 80 | 81 | # Sphinx documentation 82 | docs/_build/ 83 | 84 | # PyBuilder 85 | target/ 86 | 87 | # Jupyter Notebook 88 | .ipynb_checkpoints 89 | 90 | # IPython 91 | profile_default/ 92 | ipython_config.py 93 | 94 | # pyenv 95 | .python-version 96 | 97 | # celery beat schedule file 98 | celerybeat-schedule 99 | 100 | # SageMath parsed files 101 | *.sage.py 102 | 103 | # Environments 104 | .env 105 | .venv 106 | env/ 107 | venv/ 108 | ENV/ 109 | env.bak/ 110 | venv.bak/ 111 | 112 | # Spyder project settings 113 | .spyderproject 114 | .spyproject 115 | 116 | # Rope project settings 117 | .ropeproject 118 | 119 | # mkdocs documentation 120 | /site 121 | 122 | # mypy 123 | .mypy_cache/ 124 | .dmypy.json 125 | dmypy.json 126 | 127 | # Extras 128 | todo.txt 129 | node 130 | output.png 131 | flowchart.mmd -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2023] [Pratik Singh] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /app/prompt_templates.py: -------------------------------------------------------------------------------- 1 | from langchain.prompts import PromptTemplate 2 | from langchain.output_parsers import CommaSeparatedListOutputParser 3 | 4 | #packages 5 | from packages.prompts import * 6 | 7 | class GetPromptTemplates: 8 | def __init__(self, topic): 9 | self.topic = topic 10 | self.question_parser = CommaSeparatedListOutputParser() 11 | 12 | def ResearchPromptTemplate(self, questions = ''): 13 | if questions != '': 14 | research_bot_final_prompt = research_bot_prompt + "\n\nQuestions Answered by the user : " + questions + "\n\n" + "Output :\n\n"; 15 | else: 16 | research_bot_final_prompt = research_bot_prompt + "\n\n" + "Output :\n\n"; 17 | 18 | ResearchPromptTemplate = PromptTemplate(template= research_bot_final_prompt, input_variables=["Topic"]) 19 | # partial_variables={"format_instructions": self.research_parser.get_format_instructions()} 20 | return ResearchPromptTemplate.format_prompt(Topic = self.topic).to_string() 21 | 22 | def QuestionPromptTemplate(self): 23 | QuestionPromptTemplate = PromptTemplate(template= question_forming_prompt, input_variables=["Topic"], partial_variables={"format_instructions": self.question_parser.get_format_instructions()}) 24 | 25 | return QuestionPromptTemplate.format_prompt(Topic = self.topic).to_string() 26 | 27 | def MermaidPromptTemplate(self, information): 28 | MermaidPromptTemplate = PromptTemplate(template= mermaid_maker_prompt, input_variables=["information"]) 29 | 30 | return MermaidPromptTemplate.format_prompt(information = information).to_string() -------------------------------------------------------------------------------- /app/question_framing.py: -------------------------------------------------------------------------------- 1 | class QuestionFraming: 2 | def __init__(self, question: list): 3 | self.question = question 4 | self.answer = [] 5 | 6 | def ask_questions(self): 7 | print('\033[91m' + "Answer the following questions: (Leave blank if no answer)" + '\033[0m') 8 | for i in self.question: 9 | # print in blue color 10 | print('\033[94m' + i + "\n > " + '\033[0m', end="") 11 | answer = input() 12 | if answer == "": 13 | answer = "No answer" 14 | self.answer.append(answer) 15 | # Add more questions if needed 16 | 17 | def format_information(self): 18 | information = dict(zip(self.question, self.answer)) 19 | return information -------------------------------------------------------------------------------- /flowchart.mmd: -------------------------------------------------------------------------------- 1 | graph LR 2 | A[Introduction to Human Anatomy] --> B[Definition of Anatomy] 3 | A --> C[Importance of studying Human Anatomy] 4 | A --> D[Branches of Anatomy] 5 | B --> E[Skeletal System] 6 | C --> E 7 | D --> E 8 | E --> F[Introduction to the Skeletal System] 9 | E --> G[Functions of the Skeletal System] 10 | E --> H[Types of Bones] 11 | E --> I[Structure of a Long Bone] 12 | E --> J[Types of Joints] 13 | E --> K[Major Bones in the Human Body] 14 | F --> L[Muscular System] 15 | G --> L 16 | H --> L 17 | I --> L 18 | J --> L 19 | K --> L 20 | L --> M[Introduction to the Muscular System] 21 | L --> N[Functions of the Muscular System] 22 | L --> O[Types of Muscles] 23 | L --> P[Structure of a Muscle Fiber] 24 | L --> Q[Muscle Contractions] 25 | L --> R[Major Muscles in the Human Body] 26 | M --> S[Cardiovascular System] 27 | N --> S 28 | O --> S 29 | P --> S 30 | Q --> S 31 | R --> S 32 | S --> T[Introduction to the Cardiovascular System] 33 | S --> U[Functions of the Cardiovascular System] 34 | S --> V[Structure of the Heart] 35 | S --> W[Circulation of Blood] 36 | S --> X[Blood Vessels] 37 | S --> Y[Major Organs in the Cardiovascular System] 38 | T --> Z[Respiratory System] 39 | U --> Z 40 | V --> Z 41 | W --> Z 42 | X --> Z 43 | Y --> Z 44 | Z --> AA[Introduction to the Respiratory System] 45 | Z --> AB[Functions of the Respiratory System] 46 | Z --> AC[Structure of the Respiratory System] 47 | Z --> AD[Process of Breathing] 48 | Z --> AE[Gas Exchange in the Lungs] 49 | Z --> AF[Major Organs in the Respiratory System] 50 | AA --> AG[Digestive System] 51 | AB --> AG 52 | AC --> AG 53 | AD --> AG 54 | AE --> AG 55 | AF --> AG 56 | AG --> AH[Introduction to the Digestive System] 57 | AG --> AI[Functions of the Digestive System] 58 | AG --> AJ[Structure of the Digestive System] 59 | AG --> AK[Process of Digestion] 60 | AG --> AL[Absorption of Nutrients] 61 | AG --> AM[Major Organs in the Digestive System] 62 | AH --> AN[Nervous System] 63 | AI --> AN 64 | AJ --> AN 65 | AK --> AN 66 | AL --> AN 67 | AM --> AN 68 | AN --> AO[Introduction to the Nervous System] 69 | AN --> AP[Functions of the Nervous System] 70 | AN --> AQ[Structure of the Nervous System] 71 | AN --> AR[Neurons and Nerve Impulses] 72 | AN --> AS[Central Nervous System] 73 | AN --> AT[Peripheral Nervous System] 74 | AO --> AU[Endocrine System] 75 | AP --> AU 76 | AQ --> AU 77 | AR --> AU 78 | AS --> AU 79 | AT --> AU 80 | AU --> AV[Introduction to the Endocrine System] 81 | AU --> AW[Functions of the Endocrine System] 82 | AU --> AX[Structure of the Endocrine System] 83 | AU --> AY[Hormones and their Functions] 84 | AU --> AZ[Major Glands in the Endocrine System] 85 | AV --> BA[Reproductive System] 86 | AW --> BA 87 | AX --> BA 88 | AY --> BA 89 | AZ --> BA 90 | BA --> BB[Introduction to the Reproductive System] 91 | BA --> BC[Functions of the Reproductive System] 92 | BA --> BD[Male Reproductive System] 93 | BA --> BE[Female Reproductive System] 94 | BA --> BF[Process of Reproduction] 95 | BA --> BG[Fertilization and Pregnancy] 96 | BB --> BH[Integumentary System] 97 | BC --> BH 98 | BD --> BH 99 | BE --> BH 100 | BF --> BH 101 | BG --> BH 102 | BH --> BI[Introduction to the Integumentary System] 103 | BH --> BJ[Functions of the Integumentary System] 104 | BH --> BK[Structure of the Skin] 105 | BH --> BL[Functions of the Skin] 106 | BH --> BM[Hair, Nails, and Glands] 107 | BH --> BN[Protection and Regulation] 108 | BI --> BO[Lymphatic System] 109 | BJ --> BO 110 | BK --> BO 111 | BL --> BO 112 | BM --> BO 113 | BN --> BO 114 | BO --> BP[Introduction to the Lymphatic System] 115 | BO --> BQ[Functions of the Lymphatic System] 116 | BO --> BR[Structure of the Lymphatic System] 117 | BO --> BS[Lymph Nodes and Lymphatic Vessels] 118 | BO --> BT[Immune Response] 119 | BO --> BU[Major Organs in the Lymphatic System] 120 | BP --> BV[Urinary System] 121 | BQ --> BV 122 | BR --> BV 123 | BS --> BV 124 | BT --> BV 125 | BU --> BV 126 | BV --> BW[Introduction to the Urinary System] 127 | BV --> BX[Functions of the Urinary System] 128 | BV --> BY[Structure of the Urinary System] 129 | BV --> BZ[Kidneys and Nephrons] 130 | BV --> CA[Urine Formation] 131 | BV --> CB[Major Organs in the Urinary System] 132 | BW --> CC[Sensory System] 133 | BX --> CC 134 | BY --> CC 135 | BZ --> CC 136 | CA --> CC 137 | CB --> CC 138 | CC --> CD[Introduction to the Sensory System] 139 | CC --> CE[Functions of the Sensory System] 140 | CC --> CF[Structure of the Sensory System] 141 | CC --> CG[Vision] 142 | CC --> CH[Hearing] 143 | CC --> CI[Taste and Smell] 144 | CD --> CJ[Summary and Conclusion] 145 | CE --> CJ 146 | CF --> CJ 147 | CG --> CJ 148 | CH --> CJ 149 | CI --> CJ -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from langchain.output_parsers import CommaSeparatedListOutputParser 2 | import subprocess 3 | import os 4 | #app 5 | from app.prompt_templates import GetPromptTemplates 6 | from app.question_framing import QuestionFraming 7 | #package 8 | from packages.chains import Chains 9 | 10 | BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 11 | 12 | # Getting Topic 13 | print('\033[93m' + "Enter the topic. You can add just a keyword or a description.\nTopic : > " + '\033[0m', end="") 14 | topic = input() 15 | print() 16 | 17 | #Objects 18 | Chain = Chains() 19 | PromptTemplate = GetPromptTemplates(topic) 20 | QuestionParser = CommaSeparatedListOutputParser() 21 | 22 | # Getting Questions 23 | print('\033[92m' + "Do you want to answer some questions? (y/n) \nAnswer : > " + '\033[0m', end="") 24 | questions_allowed = input() 25 | print() 26 | 27 | if questions_allowed == 'y': 28 | questions_allowed = True 29 | else: 30 | questions_allowed = False 31 | 32 | if questions_allowed: 33 | QuestionsList = Chain.chain(PromptTemplate = PromptTemplate.QuestionPromptTemplate(), parser = QuestionParser) 34 | questionframing = QuestionFraming(QuestionsList) 35 | questionframing.ask_questions() 36 | questions = questionframing.format_information() 37 | 38 | # convert questions dictionary to string in format of - Ques. key \n Ans. value 39 | questions = '\n'.join([f'Ques. {key} \n Ans. {value}' for key, value in questions.items()]) 40 | 41 | ResearchPrompt = PromptTemplate.ResearchPromptTemplate(questions) 42 | else: 43 | ResearchPrompt = PromptTemplate.ResearchPromptTemplate() 44 | 45 | #print a brown line 46 | print('\033[93m' + "------------------------------------------------------------------------------------------------------------------------" + '\033[0m') 47 | 48 | # Getting Research Data 49 | print('\033[92m' + "Researching based on your usecase 📚\n" + '\033[0m') 50 | ResearchData = Chain.chain(PromptTemplate = ResearchPrompt) 51 | #print research completed in ligher green color and emogi 52 | print('\033[92m' + "Research completed ✅\n" + '\033[0m') 53 | 54 | print('\033[93m' + "------------------------------------------------------------------------------------------------------------------------" + '\033[0m') 55 | 56 | # Getting Mermaid Flowchart 57 | print('\033[92m' + "Generating Mermaid Flowchart 📊\n" + '\033[0m') 58 | MermaidPrompt = PromptTemplate.MermaidPromptTemplate(ResearchData) 59 | MermaidFlowchart = Chain.chain(PromptTemplate = MermaidPrompt) 60 | #print mermaid flowchart generated in ligher green color and emogi 61 | print('\033[92m' + "Mermaid Flowchart generated ✅\n" + '\033[0m') 62 | 63 | print('\033[93m' + "------------------------------------------------------------------------------------------------------------------------" + '\033[0m') 64 | 65 | # Formatting Mermaid Code 66 | if '```mermaid' in MermaidFlowchart: 67 | MermaidFlowchart = MermaidFlowchart.split('```mermaid')[1] 68 | if '```' in MermaidFlowchart: 69 | MermaidFlowchart = MermaidFlowchart.split('```')[0] 70 | 71 | # Saving Mermaid Flowchart 72 | with open('flowchart.mmd', 'w') as f: 73 | f.write(MermaidFlowchart) 74 | 75 | print('\033[92m' + "Mermaid Flowchart saved in flowchart.mmd ✅\n" + '\033[0m') 76 | 77 | # Assuming the Mermaid code is in a file called 'mermaid.mmd' 78 | mermaid_file = BASE_DIR + '/flowchart.mmd' 79 | output_file = BASE_DIR + '/outputs/output.png' 80 | 81 | # check if outputs folder exists 82 | if not os.path.exists(BASE_DIR + '/outputs'): 83 | os.makedirs(BASE_DIR + '/outputs') 84 | 85 | # Run the mmdc command 86 | try: 87 | subprocess.run(['mmdc', '-i', mermaid_file, '-o', output_file, '-b', 'transparent', '-s', '10']) 88 | print('\033[92m' + "Mermaid Flowchart saved in output.png ✅\n" + '\033[0m') 89 | except Exception as e: 90 | print('\033[91m' + "Mermaid Flowchart generation failed ❌\n" + '\033[0m') 91 | print("Exception details:", e) 92 | 93 | print('\033[93m' + "------------------------------------------------------------------------------------------------------------------------" + '\033[0m') -------------------------------------------------------------------------------- /packages/chains.py: -------------------------------------------------------------------------------- 1 | from langchain.chat_models import ChatOpenAI, ChatCohere 2 | from langchain.schema import SystemMessage 3 | from dotenv import load_dotenv 4 | 5 | if load_dotenv() == False: 6 | print('\033[91m' + "🚫 .env file not found 🚫" + '\033[0m') 7 | api_key = input("Enter your OpenAI API key and press enter to continue > ") 8 | with open('.env', 'w') as f: 9 | f.write(f"OPENAI_API_KEY='{api_key}'") 10 | load_dotenv() 11 | 12 | llm = ChatOpenAI() 13 | # llm = ChatCohere(temperature=0.3) 14 | 15 | class Chains: 16 | def __init__(self, *args): 17 | self._chains = args 18 | 19 | def chain(self, PromptTemplate, parser = None): 20 | message = [ 21 | SystemMessage(content = PromptTemplate) 22 | ] 23 | output = llm(message) 24 | if parser is None: 25 | return output.content 26 | else: 27 | return parser.parse(output.content) 28 | -------------------------------------------------------------------------------- /packages/prompts.py: -------------------------------------------------------------------------------- 1 | # research_bot_prompt_1 = '''You are a Research machine that takes a topic from the user and returns the researched topics, their subtopics and the important details based on the them to make flow chart. You return the data in dictionary format.''' 2 | 3 | research_bot_prompt = '''**Expert in Research** 4 | 5 | You are an expert in research. You are able to efficiently gather information on any topic, and you are able to synthesize this information into a cohesive and informative report. 6 | 7 | **Instructions** 8 | 9 | You will be given a topic and a set of questions and answers. Your task is to research the topic comprehensive and informative way to return a comprehensive and completely detailed personalised research for the user. The client has provided a set of questions and answers to help you understand their current senario. You should use this information to understand user's opportunities, risks and strengths and weaknesses. You should also use your own knowledge and experience to guide your research. You should structure your research in topics, subtopic tree and details on the subtopics as the output will be used to create a flowchart. There should be detailed information on the topic, subtopics and details on the subtopics creating a long chain of information. 10 | 11 | Note : Details for every subtopic should be provided. 12 | 13 | **Context** 14 | 15 | You are working with a client who is interested in learning about the topic. You need to get a good understanding of the topic and provide a comprehensive and detailed research report. The research should be personalized according to the client's needs. The output of your research should be structured as it will be used to create a flowchart. 16 | 17 | Topic : {Topic} ''' 18 | 19 | question_forming_prompt = '''Based on the given topic: "{Topic}" 20 | List 5 questions to understand the user's situation and provide the best solution. The questions will help you understand the current scenario of the user and provide optimized response. 21 | 22 | Note: The questions should be in comma separated format. For example: "What is the topic about?, What are the subtopics?, What are the branches of the subtopics?, What are the important details of the branches?" 23 | 24 | Don't used ' in the output. Use " instead. 25 | 26 | {format_instructions}''' 27 | 28 | mermaid_maker_prompt = '''### Instructions 29 | 30 | You are an expert in the subject of writing Mermaid Code. You are given a structured and organized dataset of research data. Your task is to create a mermaid diagram that represents the data in a clear and concise way. The subtopics should have detailed explanation. 31 | 32 | ### Context 33 | 34 | * The research data is organized and researched. 35 | * The Mermaid code should be designed to make the flowchart from the data as organized and structured as possible. 36 | * The Mermaid code should be designed to make the flowchart from the data as clear, organized, structured, segmented as possible. 37 | 38 | ### Output 39 | 40 | The mermaid diagram you create should be clear and concise, and should accurately represent the data. It should be easy to understand for people who are not experts in the field of data visualization. 41 | 42 | Make a flow chart based on the data and return the flow chart in the form of a string. Return the mermaid code in string format and nothing else. 43 | 44 | ### Tips 45 | 46 | To create an effective flowchart in any scenario, follow these key rules: 47 | 48 | Start with a clear purpose. 49 | Use standard symbols. 50 | Keep it simple; avoid unnecessary complexity. 51 | Follow a logical flow from top to bottom or left to right. 52 | Be consistent with symbolization and labeling. 53 | Eliminate ambiguity by making each step explicit. 54 | Clearly represent decision points with diamond shapes. 55 | Use connectors wisely to show the flow of control. 56 | Group related steps into logical sections. 57 | Tailor the level of detail to the audience's knowledge. 58 | Review, iterate, and seek feedback for clarity and accuracy. 59 | Use colors and annotations sparingly and purposefully. 60 | Test the flowchart to ensure it accurately represents the process. 61 | 62 | Note : Using special characters in mermaid code carry special meaning and should be used with caution. Use escape sequence in strings. Use \ when using paranthesis and quotes in the string. The output flowchart should not be very big in size when viewed. Make it colourful. 63 | 64 | Information to make flowchart on : {information} 65 | 66 | Mermaid Code: 67 | 68 | ''' 69 | 70 | fallback_prompt_maker = '''You are a prompt maker. Return a prompt to make a mermaid flowchart based on the data provided in the dictionary format. 71 | 72 | Information: {information} 73 | 74 | additional information: {Additional}''' 75 | 76 | #creating a group of agents for specific researches and research organizations and structuring -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # ResearchPlot 2 | 3 |
4 | LangChain Logo 5 |

6 | The LangChain Research Assistant is a Python project that leverages the power of the LangChain library and the OpenAI API to conduct research on a given topic, keyword, question, or statement. The project aims to understand the user's scenario, ask relevant questions, and generate a Mermaid code, which is then converted into a flowchart for clear and concise representation of the research findings. 7 |

8 |
9 | 10 | **Note:** This project utilizes [Mermaid.js](https://mermaid-js.github.io/mermaid/) to create flowchart images. 11 | 12 | ## Features 13 | 14 | - Topic analysis and understanding. 15 | - Intelligent question generation based on user input. 16 | - Automatic generation of Mermaid code for a flowchart representation. 17 | - Integration with the OpenAI API for enhanced natural language processing. 18 | 19 | ## Example Output 20 | 21 | ![Flowchart Example](./readme/researchplot_output.png) 22 | 23 | ## Getting Started 24 | 25 | ### Prerequisites 26 | 27 | Before running the project, ensure that you have an OpenAI API key. You can obtain one [here](https://platform.openai.com/api-keys). 28 | 29 | ## Installation 30 | 31 | 1. **Clone the repository:** 32 | 33 | ```bash 34 | git clone https://github.com/PratikSingh121/ResearchPlot.git 35 | cd ResearchPlot 36 | ``` 37 | 38 | 2. **Set up your OpenAI API key:** 39 | 40 | Obtain an OpenAI API key by following the steps below: 41 | 42 | - Visit [OpenAI's API Key page](https://platform.openai.com/api-keys). 43 | - Create an account or log in if you already have one. 44 | - Generate a new API key and copy it. 45 | 46 | Replace `OPENAI_API_KEY` in the `.env` file with the API key you obtained. 47 | 48 | ```bash 49 | # .env 50 | OPENAI_API_KEY = 'OPENAI_API_KEY' 51 | ``` 52 | 53 | 3. **Install dependencies:** 54 | 55 | - Ensure you have the required Python dependencies by running the following command: 56 | 57 | ```bash 58 | pip install -r requirements.txt 59 | ``` 60 | 61 | - Install Mermaid.js using npm. Run the following command: 62 | 63 | ```bash 64 | npm install -g @mermaid-js/mermaid-cli 65 | ``` 66 | 67 | 4. **Run the main script:** 68 | 69 | - Execute the following command in your terminal: 70 | 71 | ```bash 72 | python main.py 73 | ``` 74 | 75 | ## Usage 76 | 77 | 1. Execute the main script. 78 | 2. Enter the topic, keyword, question, or statement when prompted. 79 | 3. ResearchPlot will analyze the input, ask relevant questions, provide Mermaid code for a flowchart and the flowchart itself. 80 | 4. Visualize the flowchart to represent the research findings. 81 | 5. Image is saved in outputs folder. 82 | -------------------------------------------------------------------------------- /readme/researchplot_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PratikSingh121/ResearchPlot/9788fdcb1a030abcb1535fd4b31344d8e5cf9ceb/readme/researchplot_logo.png -------------------------------------------------------------------------------- /readme/researchplot_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PratikSingh121/ResearchPlot/9788fdcb1a030abcb1535fd4b31344d8e5cf9ceb/readme/researchplot_output.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | langchain 2 | openai 3 | python-dotenv --------------------------------------------------------------------------------