-
-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from MervinPraison/feature/PRAISON-1-add-tools
Docs
- Loading branch information
Showing
14 changed files
with
320 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Read the Docs configuration file for Sphinx projects | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the OS, Python version and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.12" | ||
# You can also specify other tool versions: | ||
# nodejs: "20" | ||
# rust: "1.70" | ||
# golang: "1.20" | ||
|
||
# Build documentation in the "docs/" directory with Sphinx | ||
sphinx: | ||
configuration: docs/conf.py | ||
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs | ||
# builder: "dirhtml" | ||
# Fail on all warnings to avoid broken references | ||
# fail_on_warning: true | ||
|
||
# Optionally build your docs in additional formats such as PDF and ePub | ||
# formats: | ||
# - epub | ||
|
||
# Optional but recommended, declare the Python requirements required | ||
# to build your documentation | ||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html | ||
# python: | ||
# install: | ||
# - requirements: docs/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM python:3.11-slim | ||
WORKDIR /app | ||
COPY . . | ||
RUN pip install flask praisonai==0.0.20 gunicorn markdown | ||
RUN pip install flask praisonai==0.0.21 gunicorn markdown | ||
EXPOSE 8080 | ||
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
framework: crewai | ||
topic: research about the latest AI News and prepare a detailed report | ||
topic: research about the causes of lung disease | ||
roles: | ||
research_analyst: | ||
backstory: Experienced in gathering and analyzing data related to AI news trends. | ||
goal: Analyze AI News trends | ||
backstory: Experienced in analyzing scientific data related to respiratory health. | ||
goal: Analyze data on lung diseases | ||
role: Research Analyst | ||
tasks: | ||
gather_data: | ||
description: Conduct in-depth research on the latest AI News trends from reputable | ||
sources. | ||
expected_output: Comprehensive report on current AI News trends. | ||
data_analysis: | ||
description: Gather and analyze data on the causes and risk factors of lung | ||
diseases. | ||
expected_output: Report detailing key findings on lung disease causes. | ||
tools: | ||
- 'InternetSearchTool' | ||
content_creator: | ||
backstory: Skilled in writing informative and engaging content about AI News. | ||
goal: Create detailed reports on AI News | ||
role: Content Creator | ||
- 'PubmedQueryRun' | ||
medical_writer: | ||
backstory: Skilled in translating complex medical information into accessible | ||
content. | ||
goal: Compile comprehensive content on lung disease causes | ||
role: Medical Writer | ||
tasks: | ||
compile_report: | ||
description: Compile all gathered data into a detailed report with analysis | ||
and insights. | ||
expected_output: Well-structured report on the latest AI News with key insights. | ||
content_creation: | ||
description: Create detailed content summarizing the research findings on | ||
lung disease causes. | ||
expected_output: Document outlining various causes and risk factors of lung | ||
diseases. | ||
tools: | ||
- '' | ||
editor: | ||
backstory: Proficient in editing medical content for accuracy and clarity. | ||
goal: Review and refine content on lung disease causes | ||
role: Editor | ||
tasks: | ||
content_review: | ||
description: Edit and refine the compiled content on lung disease causes for | ||
accuracy and coherence. | ||
expected_output: Finalized document on lung disease causes ready for dissemination. | ||
tools: | ||
- '' | ||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
framework: crewai | ||
topic: research about nvidia growth | ||
roles: | ||
data_collector: | ||
backstory: An experienced researcher with the ability to efficiently collect and | ||
organize vast amounts of data. | ||
goal: Gather information on Nvidia's growth | ||
role: Data Collector | ||
tasks: | ||
data_collection_task: | ||
description: Collect data on Nvidia's growth from various sources such as | ||
financial reports, news articles, and company announcements. | ||
expected_output: A comprehensive document detailing data points on Nvidia's | ||
growth over the years. | ||
tools: | ||
- 'YouSearchTool' | ||
data_analyst: | ||
backstory: Specializes in extracting insights from large datasets, proficient | ||
in quantitative and qualitative analysis. | ||
goal: Analyze the collected data to identify trends and patterns | ||
role: Data Analyst | ||
tasks: | ||
data_analysis_task: | ||
description: Analyze the collected data to identify key trends and patterns | ||
in Nvidia's growth. | ||
expected_output: An analytical report summarizing trends, patterns, and key | ||
growth metrics of Nvidia. | ||
tools: | ||
- '' | ||
report_preparer: | ||
backstory: Experienced in creating detailed reports and presentations, turning | ||
analytical data into actionable insights. | ||
goal: Generate a final report on Nvidia's growth | ||
role: Report Preparer | ||
tasks: | ||
report_preparation_task: | ||
description: Create a detailed report based on the analysis, highlighting | ||
Nvidia's growth trajectory. | ||
expected_output: A polished, comprehensive report summarizing Nvidia's growth | ||
with visual aids and key insights. | ||
tools: | ||
- '' | ||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
framework: crewai | ||
topic: research about the causes of lung disease | ||
roles: | ||
research_analyst: | ||
backstory: Experienced in analyzing scientific data related to respiratory health. | ||
goal: Analyze data on lung diseases | ||
role: Research Analyst | ||
tasks: | ||
data_analysis: | ||
description: Gather and analyze data on the causes and risk factors of lung | ||
diseases. | ||
expected_output: Report detailing key findings on lung disease causes. | ||
tools: | ||
- 'PubmedQueryRun' | ||
medical_writer: | ||
backstory: Skilled in translating complex medical information into accessible | ||
content. | ||
goal: Compile comprehensive content on lung disease causes | ||
role: Medical Writer | ||
tasks: | ||
content_creation: | ||
description: Create detailed content summarizing the research findings on | ||
lung disease causes. | ||
expected_output: Document outlining various causes and risk factors of lung | ||
diseases. | ||
tools: | ||
- '' | ||
editor: | ||
backstory: Proficient in editing medical content for accuracy and clarity. | ||
goal: Review and refine content on lung disease causes | ||
role: Editor | ||
tasks: | ||
content_review: | ||
description: Edit and refine the compiled content on lung disease causes for | ||
accuracy and coherence. | ||
expected_output: Finalized document on lung disease causes ready for dissemination. | ||
tools: | ||
- '' | ||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = 'PraisonAI' | ||
copyright = '2024, Mervin Praison' | ||
author = 'Mervin Praison' | ||
release = '0.0.21' | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx_rtd_theme'] | ||
|
||
templates_path = ['_templates'] | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = 'alabaster' | ||
html_static_path = ['_static'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.. PraisonAI documentation master file, created by | ||
sphinx-quickstart on Mon Jun 10 12:11:57 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to PraisonAI's documentation! | ||
===================================== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=. | ||
set BUILDDIR=_build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# tools.py | ||
from duckduckgo_search import DDGS | ||
from praisonai_tools import BaseTool | ||
|
||
class InternetSearchTool(BaseTool): | ||
name: str = "InternetSearchTool" | ||
description: str = "Search Internet for relevant information based on a query or latest news" | ||
|
||
def _run(self, query: str): | ||
ddgs = DDGS() | ||
results = ddgs.text(keywords=query, region='wt-wt', safesearch='moderate', max_results=5) | ||
return results | ||
|
||
from langchain_community.tools.pubmed.tool import PubmedQueryRun | ||
from langchain_community.tools.reddit_search.tool import RedditSearchRun | ||
# pip install tavily-python | ||
from langchain_community.utilities.tavily_search import TavilySearchAPIWrapper | ||
from langchain_community.utilities.you import YouSearchAPIWrapper | ||
# pip install youtube_search | ||
from langchain_community.tools import YouTubeSearchTool | ||
# pip install wikipedia | ||
from langchain_community.utilities import WikipediaAPIWrapper | ||
|
||
class TavilyTool(BaseTool): | ||
name: str = "TavilyTool" | ||
description: str = "Search Tavily for relevant information based on a query." | ||
|
||
def _run(self, query: str): | ||
api_wrapper = TavilySearchAPIWrapper() | ||
results = api_wrapper.results(query=query, max_results=5) | ||
return results | ||
|
||
class YouSearchTool(BaseTool): | ||
name: str = "You Search Tool" | ||
description: str = "Search You.com for relevant information based on a query." | ||
|
||
def _run(self, query: str): | ||
api_wrapper = YouSearchAPIWrapper() | ||
results = api_wrapper.results(query=query, max_results=5) | ||
return results | ||
|
||
class WikipediaSearchTool(BaseTool): | ||
name: str = "WikipediaSearchTool" | ||
description: str = "Search Wikipedia for relevant information based on a query." | ||
|
||
def _run(self, query: str): | ||
api_wrapper = WikipediaAPIWrapper(top_k_results=4, doc_content_chars_max=100) | ||
results = api_wrapper.load(query=query) | ||
return results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters