v0.0.39 Pass Raw Agents YAML Content instead of agents.yaml file
No files matched your search
@@ -1,6 +1,6 @@
|
||||
FROM python:3.11-slim
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN pip install flask praisonai==0.0.38 gunicorn markdown
|
||||
RUN pip install flask praisonai==0.0.39 gunicorn markdown
|
||||
EXPOSE 8080
|
||||
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]
|
||||
@@ -1,39 +1,42 @@
|
||||
framework: autogen
|
||||
topic: research about the causes of lung disease
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
research_analyst:
|
||||
backstory: Experienced in analyzing scientific data related to respiratory health.
|
||||
goal: Analyze data on lung diseases
|
||||
role: Research Analyst
|
||||
researcher:
|
||||
backstory: Skilled in finding relevant information from various sources, with
|
||||
a focus on accuracy.
|
||||
goal: Gather information about cats and Mars
|
||||
role: Researcher
|
||||
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:
|
||||
- 'InternetSearchTool'
|
||||
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.
|
||||
information_gathering:
|
||||
description: Gather information about cats, their behavior, and Mars, including
|
||||
its environment and potential for life.
|
||||
expected_output: Document with research findings, including cat behavior,
|
||||
Mars environment, and potential for life.
|
||||
tools:
|
||||
- ''
|
||||
editor:
|
||||
backstory: Proficient in editing medical content for accuracy and clarity.
|
||||
goal: Review and refine content on lung disease causes
|
||||
role: Editor
|
||||
world_builder:
|
||||
backstory: Expert in building immersive worlds, with a focus on detail and consistency.
|
||||
goal: Create a rich world for the movie script
|
||||
role: World Builder
|
||||
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.
|
||||
world_creation:
|
||||
description: Create a rich world for the movie script, including the Martian
|
||||
environment, cat behavior, and other essential elements.
|
||||
expected_output: Document with detailed world-building information, including
|
||||
Martian environment, cat behavior, and other essential elements.
|
||||
tools:
|
||||
- ''
|
||||
dependencies: []
|
||||
screenwriter:
|
||||
backstory: Skilled in writing engaging movie scripts, with a focus on storytelling
|
||||
and character development.
|
||||
goal: Write a movie script about a cat in Mars
|
||||
role: Screenwriter
|
||||
tasks:
|
||||
scriptwriting_task:
|
||||
description: Write a movie script about a cat in Mars, incorporating the research
|
||||
findings and world-building information.
|
||||
expected_output: Production-ready movie script with dialogue, scenes, and
|
||||
a compelling story.
|
||||
tools:
|
||||
- ''
|
||||
dependencies: []
|
||||
@@ -258,6 +258,8 @@ task_callback (callable, optional): A callback function to be executed after eac
|
||||
# print(self.config_list)
|
||||
llm_config = {"config_list": self.config_list}
|
||||
|
||||
if agentops_exists:
|
||||
agentops.init(os.environ.get("AGENTOPS_API_KEY"), tags=["autogen"])
|
||||
# Assuming the user proxy agent is set up as per your requirements
|
||||
user_proxy = autogen.UserProxyAgent(
|
||||
name="User",
|
||||
@@ -301,10 +303,13 @@ task_callback (callable, optional): A callback function to be executed after eac
|
||||
# Additional fields like carryover can be added based on dependencies
|
||||
}
|
||||
tasks.append(chat_task)
|
||||
|
||||
response = user_proxy.initiate_chats(tasks)
|
||||
result = "### Output ###\n"+response[-1].summary if hasattr(response[-1], 'summary') else ""
|
||||
else:
|
||||
if agentops_exists:
|
||||
agentops.end_session("Success")
|
||||
else: # framework=crewai
|
||||
if agentops_exists:
|
||||
agentops.init(os.environ.get("AGENTOPS_API_KEY"), tags=["crewai"])
|
||||
for role, details in config['roles'].items():
|
||||
role_filled = details['role'].format(topic=topic)
|
||||
goal_filled = details['goal'].format(topic=topic)
|
||||
@@ -312,7 +317,40 @@ task_callback (callable, optional): A callback function to be executed after eac
|
||||
|
||||
# Adding tools to the agent if exists
|
||||
agent_tools = [tools_dict[tool] for tool in details.get('tools', []) if tool in tools_dict]
|
||||
agent = Agent(role=role_filled, goal=goal_filled, backstory=backstory_filled, tools=agent_tools, allow_delegation=False)
|
||||
|
||||
llm_model = details.get('llm') # Get the llm configuration
|
||||
if llm_model:
|
||||
llm = PraisonAIModel(
|
||||
model=llm_model.get("model", os.environ.get("MODEL_NAME", "openai/gpt-4o")),
|
||||
).get_model()
|
||||
else:
|
||||
llm = PraisonAIModel().get_model()
|
||||
|
||||
function_calling_llm_model = details.get('function_calling_llm')
|
||||
if function_calling_llm_model:
|
||||
function_calling_llm = PraisonAIModel(
|
||||
model=function_calling_llm_model.get("model", os.environ.get("MODEL_NAME", "openai/gpt-4o")),
|
||||
).get_model()
|
||||
else:
|
||||
function_calling_llm = PraisonAIModel().get_model()
|
||||
|
||||
agent = Agent(
|
||||
role=role_filled,
|
||||
goal=goal_filled,
|
||||
backstory=backstory_filled,
|
||||
tools=agent_tools,
|
||||
allow_delegation=details.get('allow_delegation', False),
|
||||
llm=llm,
|
||||
function_calling_llm=function_calling_llm,
|
||||
max_iter=details.get('max_iter', 15),
|
||||
max_rpm=details.get('max_rpm'),
|
||||
max_execution_time=details.get('max_execution_time'),
|
||||
verbose=details.get('verbose', True),
|
||||
cache=details.get('cache', True),
|
||||
system_template=details.get('system_template'),
|
||||
prompt_template=details.get('prompt_template'),
|
||||
response_template=details.get('response_template'),
|
||||
)
|
||||
|
||||
# Set agent callback if provided
|
||||
if self.agent_callback:
|
||||
@@ -331,15 +369,12 @@ task_callback (callable, optional): A callback function to be executed after eac
|
||||
task.callback = self.task_callback
|
||||
|
||||
tasks.append(task)
|
||||
if agentops:
|
||||
agentops.init()
|
||||
|
||||
crew = Crew(
|
||||
agents=list(agents.values()),
|
||||
tasks=tasks,
|
||||
verbose=2
|
||||
)
|
||||
if agentops:
|
||||
agentops.end_session("Success")
|
||||
|
||||
self.logger.debug("Final Crew Configuration:")
|
||||
self.logger.debug(f"Agents: {crew.agents}")
|
||||
@@ -347,6 +382,8 @@ task_callback (callable, optional): A callback function to be executed after eac
|
||||
|
||||
response = crew.kickoff()
|
||||
result = f"### Task Output ###\n{response}"
|
||||
if agentops_exists:
|
||||
agentops.end_session("Success")
|
||||
return result</code></pre>
|
||||
</details>
|
||||
<h3>Methods</h3>
|
||||
|
||||
@@ -295,7 +295,7 @@ print(prompt)</p></div>
|
||||
<span>(</span><span>**data: Any)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"><p>Usage docs: <a href="https://docs.pydantic.dev/2.7/concepts/models/">https://docs.pydantic.dev/2.7/concepts/models/</a></p>
|
||||
<div class="desc"><p>Usage docs: <a href="https://docs.pydantic.dev/2.8/concepts/models/">https://docs.pydantic.dev/2.8/concepts/models/</a></p>
|
||||
<p>A base class for creating Pydantic models.</p>
|
||||
<h2 id="attributes">Attributes</h2>
|
||||
<dl>
|
||||
@@ -395,7 +395,7 @@ validated to form a valid model.</p>
|
||||
<span>(</span><span>**data: Any)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"><p>Usage docs: <a href="https://docs.pydantic.dev/2.7/concepts/models/">https://docs.pydantic.dev/2.7/concepts/models/</a></p>
|
||||
<div class="desc"><p>Usage docs: <a href="https://docs.pydantic.dev/2.8/concepts/models/">https://docs.pydantic.dev/2.8/concepts/models/</a></p>
|
||||
<p>A base class for creating Pydantic models.</p>
|
||||
<h2 id="attributes">Attributes</h2>
|
||||
<dl>
|
||||
@@ -480,7 +480,7 @@ validated to form a valid model.</p>
|
||||
<span>(</span><span>**data: Any)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"><p>Usage docs: <a href="https://docs.pydantic.dev/2.7/concepts/models/">https://docs.pydantic.dev/2.7/concepts/models/</a></p>
|
||||
<div class="desc"><p>Usage docs: <a href="https://docs.pydantic.dev/2.8/concepts/models/">https://docs.pydantic.dev/2.8/concepts/models/</a></p>
|
||||
<p>A base class for creating Pydantic models.</p>
|
||||
<h2 id="attributes">Attributes</h2>
|
||||
<dl>
|
||||
|
||||
@@ -110,7 +110,7 @@ Loads environment variables from .env file or system and sets them.</p>
|
||||
file.write("FROM python:3.11-slim\n")
|
||||
file.write("WORKDIR /app\n")
|
||||
file.write("COPY . .\n")
|
||||
file.write("RUN pip install flask praisonai==0.0.38 gunicorn markdown\n")
|
||||
file.write("RUN pip install flask praisonai==0.0.39 gunicorn markdown\n")
|
||||
file.write("EXPOSE 8080\n")
|
||||
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.1">
|
||||
<title>praisonai.inc API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin>
|
||||
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:1.5em;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:2em 0 .50em 0}h3{font-size:1.4em;margin:1.6em 0 .7em 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .2s ease-in-out}a:visited{color:#503}a:hover{color:#b62}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900;font-weight:bold}pre code{font-size:.8em;line-height:1.4em;padding:1em;display:block}code{background:#f3f3f3;font-family:"DejaVu Sans Mono",monospace;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em 1em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
|
||||
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul ul{padding-left:1em}.toc > ul > li{margin-top:.5em}}</style>
|
||||
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
|
||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script>
|
||||
<script>window.addEventListener('DOMContentLoaded', () => {
|
||||
hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']});
|
||||
hljs.highlightAll();
|
||||
})</script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<article id="content">
|
||||
<header>
|
||||
<h1 class="title">Module <code>praisonai.inc</code></h1>
|
||||
</header>
|
||||
<section id="section-intro">
|
||||
</section>
|
||||
<section>
|
||||
<h2 class="section-title" id="header-submodules">Sub-modules</h2>
|
||||
<dl>
|
||||
<dt><code class="name"><a title="praisonai.inc.models" href="models.html">praisonai.inc.models</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
</article>
|
||||
<nav id="sidebar">
|
||||
<div class="toc">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<ul id="index">
|
||||
<li><h3>Super-module</h3>
|
||||
<ul>
|
||||
<li><code><a title="praisonai" href="../index.html">praisonai</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><h3><a href="#header-submodules">Sub-modules</a></h3>
|
||||
<ul>
|
||||
<li><code><a title="praisonai.inc.models" href="models.html">praisonai.inc.models</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.1</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,196 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||
<meta name="generator" content="pdoc3 0.11.1">
|
||||
<title>praisonai.inc.models API documentation</title>
|
||||
<meta name="description" content="">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin>
|
||||
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:1.5em;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:2em 0 .50em 0}h3{font-size:1.4em;margin:1.6em 0 .7em 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .2s ease-in-out}a:visited{color:#503}a:hover{color:#b62}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900;font-weight:bold}pre code{font-size:.8em;line-height:1.4em;padding:1em;display:block}code{background:#f3f3f3;font-family:"DejaVu Sans Mono",monospace;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em 1em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
|
||||
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul ul{padding-left:1em}.toc > ul > li{margin-top:.5em}}</style>
|
||||
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
|
||||
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script>
|
||||
<script>window.addEventListener('DOMContentLoaded', () => {
|
||||
hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']});
|
||||
hljs.highlightAll();
|
||||
})</script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<article id="content">
|
||||
<header>
|
||||
<h1 class="title">Module <code>praisonai.inc.models</code></h1>
|
||||
</header>
|
||||
<section id="section-intro">
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
<h2 class="section-title" id="header-classes">Classes</h2>
|
||||
<dl>
|
||||
<dt id="praisonai.inc.models.PraisonAIModel"><code class="flex name class">
|
||||
<span>class <span class="ident">PraisonAIModel</span></span>
|
||||
<span>(</span><span>model=None, api_key_var=None, base_url=None)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"><p>Initializes the PraisonAIModel with the provided parameters or environment variables.</p>
|
||||
<h2 id="args">Args</h2>
|
||||
<dl>
|
||||
<dt><strong><code>model</code></strong> : <code>str</code>, optional</dt>
|
||||
<dd>The name of the OpenAI model. Defaults to None.</dd>
|
||||
<dt><strong><code>api_key_var</code></strong> : <code>str</code>, optional</dt>
|
||||
<dd>The OpenAI API key. Defaults to None.</dd>
|
||||
<dt><strong><code>base_url</code></strong> : <code>str</code>, optional</dt>
|
||||
<dd>The base URL for the OpenAI API. Defaults to None.</dd>
|
||||
</dl></div>
|
||||
<details class="source">
|
||||
<summary>
|
||||
<span>Expand source code</span>
|
||||
</summary>
|
||||
<pre><code class="python">class PraisonAIModel:
|
||||
def __init__(self, model=None, api_key_var=None, base_url=None):
|
||||
"""
|
||||
Initializes the PraisonAIModel with the provided parameters or environment variables.
|
||||
|
||||
Args:
|
||||
model (str, optional): The name of the OpenAI model. Defaults to None.
|
||||
api_key_var (str, optional): The OpenAI API key. Defaults to None.
|
||||
base_url (str, optional): The base URL for the OpenAI API. Defaults to None.
|
||||
"""
|
||||
self.model = model or os.getenv("OPENAI_MODEL_NAME", "gpt-4o")
|
||||
if self.model.startswith("openai/"):
|
||||
self.api_key_var = "OPENAI_API_KEY"
|
||||
self.base_url = base_url or "https://api.openai.com/v1"
|
||||
self.model_name = self.model.replace("openai/", "")
|
||||
elif self.model.startswith("groq/"):
|
||||
self.api_key_var = "GROQ_API_KEY"
|
||||
self.base_url = base_url or "https://api.groq.com/openai/v1"
|
||||
self.model_name = self.model.replace("groq/", "")
|
||||
elif self.model.startswith("cohere/"):
|
||||
self.api_key_var = "COHERE_API_KEY"
|
||||
self.base_url = ""
|
||||
self.model_name = self.model.replace("cohere/", "")
|
||||
elif self.model.startswith("ollama/"):
|
||||
self.api_key_var = "OLLAMA_API_KEY"
|
||||
self.base_url = base_url or "http://localhost:11434/v1"
|
||||
self.model_name = self.model.replace("ollama/", "")
|
||||
elif self.model.startswith("anthropic/"):
|
||||
self.api_key_var = "ANTHROPIC_API_KEY"
|
||||
self.base_url = ""
|
||||
self.model_name = self.model.replace("anthropic/", "")
|
||||
elif self.model.startswith("google/"):
|
||||
self.api_key_var = "GOOGLE_API_KEY"
|
||||
self.base_url = ""
|
||||
self.model_name = self.model.replace("google/", "")
|
||||
else:
|
||||
self.api_key_var = api_key_var or "OPENAI_API_KEY"
|
||||
self.base_url = base_url or os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1")
|
||||
self.model_name = self.model
|
||||
logger.debug(f"Initialized PraisonAIModel with model {self.model_name}, api_key_var {self.api_key_var}, and base_url {self.base_url}")
|
||||
self.api_key = os.environ.get(self.api_key_var, "nokey")
|
||||
|
||||
def get_model(self):
|
||||
"""
|
||||
Returns an instance of the langchain Chat client with the configured parameters.
|
||||
|
||||
Returns:
|
||||
Chat: An instance of the langchain Chat client.
|
||||
"""
|
||||
if self.model.startswith("google/"):
|
||||
if GOOGLE_GENAI_AVAILABLE:
|
||||
return ChatGoogleGenerativeAI(
|
||||
model=self.model_name,
|
||||
google_api_key=self.api_key
|
||||
)
|
||||
else:
|
||||
raise ImportError(
|
||||
"Required Langchain Integration 'langchain-google-genai' not found. "
|
||||
"Please install with 'pip install langchain-google-genai'"
|
||||
)
|
||||
elif self.model.startswith("cohere/"):
|
||||
if COHERE_AVAILABLE:
|
||||
return ChatCohere(
|
||||
model=self.model_name,
|
||||
cohere_api_key=self.api_key,
|
||||
)
|
||||
else:
|
||||
raise ImportError(
|
||||
"Required Langchain Integration 'langchain-cohere' not found. "
|
||||
"Please install with 'pip install langchain-cohere'"
|
||||
)
|
||||
elif self.model.startswith("anthropic/"):
|
||||
if ANTHROPIC_AVAILABLE:
|
||||
return ChatAnthropic(
|
||||
model=self.model_name,
|
||||
anthropic_api_key=self.api_key,
|
||||
)
|
||||
else:
|
||||
raise ImportError(
|
||||
"Required Langchain Integration 'langchain-anthropic' not found. "
|
||||
"Please install with 'pip install langchain-anthropic'"
|
||||
)
|
||||
elif OPENAI_AVAILABLE:
|
||||
return ChatOpenAI(
|
||||
model=self.model_name,
|
||||
api_key=self.api_key,
|
||||
base_url=self.base_url,
|
||||
)
|
||||
else:
|
||||
raise ImportError(
|
||||
"Required Langchain Integration 'langchain-openai' not found. "
|
||||
"Please install with 'pip install langchain-openai'"
|
||||
)</code></pre>
|
||||
</details>
|
||||
<h3>Methods</h3>
|
||||
<dl>
|
||||
<dt id="praisonai.inc.models.PraisonAIModel.get_model"><code class="name flex">
|
||||
<span>def <span class="ident">get_model</span></span>(<span>self)</span>
|
||||
</code></dt>
|
||||
<dd>
|
||||
<div class="desc"><p>Returns an instance of the langchain Chat client with the configured parameters.</p>
|
||||
<h2 id="returns">Returns</h2>
|
||||
<dl>
|
||||
<dt><code>Chat</code></dt>
|
||||
<dd>An instance of the langchain Chat client.</dd>
|
||||
</dl></div>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</article>
|
||||
<nav id="sidebar">
|
||||
<div class="toc">
|
||||
<ul></ul>
|
||||
</div>
|
||||
<ul id="index">
|
||||
<li><h3>Super-module</h3>
|
||||
<ul>
|
||||
<li><code><a title="praisonai.inc" href="index.html">praisonai.inc</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><h3><a href="#header-classes">Classes</a></h3>
|
||||
<ul>
|
||||
<li>
|
||||
<h4><code><a title="praisonai.inc.models.PraisonAIModel" href="#praisonai.inc.models.PraisonAIModel">PraisonAIModel</a></code></h4>
|
||||
<ul class="">
|
||||
<li><code><a title="praisonai.inc.models.PraisonAIModel.get_model" href="#praisonai.inc.models.PraisonAIModel.get_model">get_model</a></code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.1</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -49,6 +49,10 @@ hljs.highlightAll();
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt><code class="name"><a title="praisonai.inc" href="inc/index.html">praisonai.inc</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
</dd>
|
||||
<dt><code class="name"><a title="praisonai.test" href="test.html">praisonai.test</a></code></dt>
|
||||
<dd>
|
||||
<div class="desc"></div>
|
||||
@@ -78,6 +82,7 @@ hljs.highlightAll();
|
||||
<li><code><a title="praisonai.cli" href="cli.html">praisonai.cli</a></code></li>
|
||||
<li><code><a title="praisonai.deploy" href="deploy.html">praisonai.deploy</a></code></li>
|
||||
<li><code><a title="praisonai.inbuilt_tools" href="inbuilt_tools/index.html">praisonai.inbuilt_tools</a></code></li>
|
||||
<li><code><a title="praisonai.inc" href="inc/index.html">praisonai.inc</a></code></li>
|
||||
<li><code><a title="praisonai.test" href="test.html">praisonai.test</a></code></li>
|
||||
<li><code><a title="praisonai.version" href="version.html">praisonai.version</a></code></li>
|
||||
</ul>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# AutoGen Low Code with Praison AI
|
||||
|
||||
Low Code solution to run AutoGen
|
||||
|
||||
```bash
|
||||
pip install praisonai
|
||||
```
|
||||
|
||||
```bash
|
||||
export OPENAI_API_KEY=xxxxxxxxxx
|
||||
```
|
||||
|
||||
```bash
|
||||
praisonai --framework autogen --init Create a Movie Script About Cat in Mars
|
||||
```
|
||||
|
||||
```bash
|
||||
praisonai --framework autogen
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
# CrewAI Low Code with PraisonAI
|
||||
|
||||
Low Code solution to run CrewAI
|
||||
|
||||
```bash
|
||||
pip install praisonai
|
||||
```
|
||||
|
||||
```bash
|
||||
export OPENAI_API_KEY=xxxxxxxxxx
|
||||
```
|
||||
|
||||
```bash
|
||||
praisonai --framework crewai --init Create a Movie Script About Cat in Mars
|
||||
```
|
||||
|
||||
```bash
|
||||
praisonai --framework crewai
|
||||
```
|
||||
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
@@ -0,0 +1,67 @@
|
||||
# Models in PraisonAI
|
||||
|
||||
- [OpenAI](models/openai.md)
|
||||
- [Groq](models/groq.md)
|
||||
- [Google Gemini](models/google.md)
|
||||
- [Anthropic Claude](models/anthropic.md)
|
||||
- [Cohere](models/cohere.md)
|
||||
- [Mistral](models/mistral.md)
|
||||
- [Ollama](models/ollama.md)
|
||||
- [Other Models](models/other.md)
|
||||
|
||||
|
||||
## Example agents.yaml
|
||||
|
||||
This uses Multi-Agents with Multi-LLMs.
|
||||
|
||||
```yaml
|
||||
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
|
||||
llm:
|
||||
model: "groq/llama3-70b-8192"
|
||||
function_calling_llm:
|
||||
model: "google/gemini-1.5-flash-001"
|
||||
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:
|
||||
- 'InternetSearchTool'
|
||||
medical_writer:
|
||||
backstory: Skilled in translating complex medical information into accessible
|
||||
content.
|
||||
goal: Compile comprehensive content on lung disease causes
|
||||
role: Medical Writer
|
||||
llm:
|
||||
model: "anthropic/claude-3-haiku-20240307"
|
||||
function_calling_llm:
|
||||
model: "openai/gpt-4o"
|
||||
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
|
||||
llm:
|
||||
model: "cohere/command-r"
|
||||
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: []
|
||||
```
|
||||
@@ -0,0 +1,31 @@
|
||||
# Add Anthropic to Praison AI
|
||||
|
||||
```bash
|
||||
pip install langchain-anthropic
|
||||
```
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY=xxxxxxxxxx
|
||||
```
|
||||
|
||||
### agents.yaml file
|
||||
|
||||
```yaml
|
||||
framework: crewai
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
researcher:
|
||||
backstory: Skilled in finding and organizing information, with a focus on research
|
||||
efficiency.
|
||||
goal: Gather information about Mars and cats
|
||||
role: Researcher
|
||||
llm:
|
||||
model: "anthropic/claude-3-haiku-20240307"
|
||||
tasks:
|
||||
gather_research:
|
||||
description: Research and gather information about Mars, its environment,
|
||||
and cats, including their behavior and characteristics.
|
||||
expected_output: Document with research findings, including interesting facts
|
||||
and information.
|
||||
tools:
|
||||
- ''
|
||||
```
|
||||
@@ -0,0 +1,31 @@
|
||||
# Add COHERE to Praison AI
|
||||
|
||||
```bash
|
||||
pip install langchain-cohere
|
||||
```
|
||||
```bash
|
||||
export COHERE_API_KEY=xxxxxxxxxx
|
||||
```
|
||||
|
||||
### agents.yaml file
|
||||
|
||||
```yaml
|
||||
framework: crewai
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
researcher:
|
||||
backstory: Skilled in finding and organizing information, with a focus on research
|
||||
efficiency.
|
||||
goal: Gather information about Mars and cats
|
||||
role: Researcher
|
||||
llm:
|
||||
model: "cohere/command-r"
|
||||
tasks:
|
||||
gather_research:
|
||||
description: Research and gather information about Mars, its environment,
|
||||
and cats, including their behavior and characteristics.
|
||||
expected_output: Document with research findings, including interesting facts
|
||||
and information.
|
||||
tools:
|
||||
- ''
|
||||
```
|
||||
@@ -0,0 +1,31 @@
|
||||
# Add Google Gemini to Praison AI
|
||||
|
||||
```bash
|
||||
pip install langchain-google-genai
|
||||
```
|
||||
```bash
|
||||
export GOOGLE_API_KEY=xxxxxxxxxx
|
||||
```
|
||||
|
||||
### agents.yaml file
|
||||
|
||||
```yaml
|
||||
framework: crewai
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
researcher:
|
||||
backstory: Skilled in finding and organizing information, with a focus on research
|
||||
efficiency.
|
||||
goal: Gather information about Mars and cats
|
||||
role: Researcher
|
||||
llm:
|
||||
model: "google/gemini-1.5-flash-001"
|
||||
tasks:
|
||||
gather_research:
|
||||
description: Research and gather information about Mars, its environment,
|
||||
and cats, including their behavior and characteristics.
|
||||
expected_output: Document with research findings, including interesting facts
|
||||
and information.
|
||||
tools:
|
||||
- ''
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
# Add GROQ to Praison AI
|
||||
|
||||
```bash
|
||||
export GROQ_API_KEY=xxxxxxxxxx
|
||||
```
|
||||
|
||||
### agents.yaml file
|
||||
|
||||
```yaml
|
||||
framework: crewai
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
researcher:
|
||||
backstory: Skilled in finding and organizing information, with a focus on research
|
||||
efficiency.
|
||||
goal: Gather information about Mars and cats
|
||||
role: Researcher
|
||||
llm:
|
||||
model: "groq/llama3-70b-8192"
|
||||
tasks:
|
||||
gather_research:
|
||||
description: Research and gather information about Mars, its environment,
|
||||
and cats, including their behavior and characteristics.
|
||||
expected_output: Document with research findings, including interesting facts
|
||||
and information.
|
||||
tools:
|
||||
- ''
|
||||
```
|
||||
@@ -0,0 +1,32 @@
|
||||
# Add Mistral to Praison AI
|
||||
|
||||
Note: If you want to use Mistral via Ollama, please refer to Ollama document. This is for using Mistral from https://mistral.ai
|
||||
|
||||
## Using Single Agent
|
||||
|
||||
```bash
|
||||
export OPENAI_API_KEY=xxxxxxxxxx
|
||||
export OPENAI_MODEL_NAME=mistral-large
|
||||
export OPENAI_API_BASE="https://api.mistral.ai/v1"
|
||||
```
|
||||
|
||||
### agents.yaml file
|
||||
|
||||
```yaml
|
||||
framework: crewai
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
researcher:
|
||||
backstory: Skilled in finding and organizing information, with a focus on research
|
||||
efficiency.
|
||||
goal: Gather information about Mars and cats
|
||||
role: Researcher
|
||||
tasks:
|
||||
gather_research:
|
||||
description: Research and gather information about Mars, its environment,
|
||||
and cats, including their behavior and characteristics.
|
||||
expected_output: Document with research findings, including interesting facts
|
||||
and information.
|
||||
tools:
|
||||
- ''
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
# Add Ollama to Praison AI
|
||||
|
||||
### agents.yaml file
|
||||
|
||||
```yaml
|
||||
framework: crewai
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
researcher:
|
||||
backstory: Skilled in finding and organizing information, with a focus on research
|
||||
efficiency.
|
||||
goal: Gather information about Mars and cats
|
||||
role: Researcher
|
||||
llm:
|
||||
model: "ollama/llama3"
|
||||
tasks:
|
||||
gather_research:
|
||||
description: Research and gather information about Mars, its environment,
|
||||
and cats, including their behavior and characteristics.
|
||||
expected_output: Document with research findings, including interesting facts
|
||||
and information.
|
||||
tools:
|
||||
- ''
|
||||
```
|
||||
@@ -0,0 +1,85 @@
|
||||
# Add OPENAI ChatGPT to Praison AI
|
||||
|
||||
## Using Single Agent
|
||||
|
||||
```bash
|
||||
export OPENAI_API_KEY=xxxxxxxxxx
|
||||
export OPENAI_MODEL_NAME=gpt-4o
|
||||
```
|
||||
|
||||
### agents.yaml file
|
||||
```yaml
|
||||
framework: crewai
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
researcher:
|
||||
backstory: Skilled in finding and organizing information, with a focus on research
|
||||
efficiency.
|
||||
goal: Gather information about Mars and cats
|
||||
role: Researcher
|
||||
tasks:
|
||||
gather_research:
|
||||
description: Research and gather information about Mars, its environment,
|
||||
and cats, including their behavior and characteristics.
|
||||
expected_output: Document with research findings, including interesting facts
|
||||
and information.
|
||||
tools:
|
||||
- ''
|
||||
```
|
||||
|
||||
You can also mention the model name in the agents.yaml file
|
||||
|
||||
### agents.yaml file
|
||||
```yaml
|
||||
framework: crewai
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
researcher:
|
||||
backstory: Skilled in finding and organizing information, with a focus on research
|
||||
efficiency.
|
||||
goal: Gather information about Mars and cats
|
||||
role: Researcher
|
||||
llm:
|
||||
model: "gpt-4o"
|
||||
tasks:
|
||||
gather_research:
|
||||
description: Research and gather information about Mars, its environment,
|
||||
and cats, including their behavior and characteristics.
|
||||
expected_output: Document with research findings, including interesting facts
|
||||
and information.
|
||||
tools:
|
||||
- ''
|
||||
```
|
||||
|
||||
|
||||
## Using Multi Agents
|
||||
|
||||
```bash
|
||||
pip install langchain-openai
|
||||
```
|
||||
```bash
|
||||
export OPENAI_API_KEY=xxxxxxxxxx
|
||||
```
|
||||
|
||||
### agents.yaml file
|
||||
|
||||
```yaml
|
||||
framework: crewai
|
||||
topic: create movie script about cat in mars
|
||||
roles:
|
||||
researcher:
|
||||
backstory: Skilled in finding and organizing information, with a focus on research
|
||||
efficiency.
|
||||
goal: Gather information about Mars and cats
|
||||
role: Researcher
|
||||
llm:
|
||||
model: "openai/gpt-4o"
|
||||
tasks:
|
||||
gather_research:
|
||||
description: Research and gather information about Mars, its environment,
|
||||
and cats, including their behavior and characteristics.
|
||||
expected_output: Document with research findings, including interesting facts
|
||||
and information.
|
||||
tools:
|
||||
- ''
|
||||
```
|
||||
@@ -0,0 +1,13 @@
|
||||
# AgentOps PraisonAI Monitoring
|
||||
|
||||
```bash
|
||||
pip install "praisonai[agentops]"
|
||||
```
|
||||
|
||||
```bash
|
||||
export AGENTOPS_API_KEY=xxxxxxxx
|
||||
```
|
||||
|
||||
## Dashboard
|
||||
|
||||

|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Sure! Let's go through the steps to install and set up the PraisonAI tool.
|
||||
|
||||
Quickstart: Use [PraisonAI Tools Creator GPT](../tools/gpt.md) to get started quickly.
|
||||
|
||||
## Step 1: Install the `praisonai` Package
|
||||
|
||||
First, you need to install the `praisonai` package. Open your terminal and run the following command:
|
||||
@@ -83,7 +85,7 @@ praisonai --init research about the latest AI News and prepare a detailed report
|
||||
```
|
||||
|
||||
- Add `- InternetSearchTool` in the agents.yaml file in the tools section.
|
||||
- Create a file called tools.py and add this code [tools.py](./tools.py)
|
||||
- Create a file called tools.py and add this code [tools.py](tools.py)
|
||||
|
||||
```bash
|
||||
praisonai
|
||||
@@ -0,0 +1,3 @@
|
||||
# PraisonAI Tools Creator GPT
|
||||
|
||||
Use [PraisonAI Tools Creator GPT](https://chatgpt.com/g/g-LrJH1K6Ao-praisonai-tools-creator) to get started quickly.
|
||||
@@ -9,26 +9,43 @@ nav:
|
||||
- 🏠 Home:
|
||||
- Home: home.md
|
||||
- TL;DR: tldr.md
|
||||
- User Interface: ui.md
|
||||
- Other Models: other_models.md
|
||||
|
||||
- ⚡ Getting Started:
|
||||
- Installation: installation.md
|
||||
- Initialise: initialise.md
|
||||
- Run: run.md
|
||||
- Full Automatic: auto.md
|
||||
- User Interface: ui.md
|
||||
- CrewAI: framework/crewai.md
|
||||
- AutoGen: framework/autogen.md
|
||||
|
||||
- 🧠 Models:
|
||||
- Models: models.md
|
||||
- OpenAI: models/openai.md
|
||||
- Groq: models/groq.md
|
||||
- Google Gemini: models/google.md
|
||||
- Anthropic Claude: models/anthropic.md
|
||||
- Cohere: models/cohere.md
|
||||
- Mistral: models/mistral.md
|
||||
- Ollama: models/ollama.md
|
||||
- Other Models: models/other.md
|
||||
|
||||
- ⚙️ Tools:
|
||||
- Tools: tools.md
|
||||
- Create Custom Tools: custom_tools.md
|
||||
- DuckDuckGo: duckduckgo.md
|
||||
- Langchain: langchain.md
|
||||
- Create Custom Tools: tools/custom.md
|
||||
- Tools Creator GPT: tools/gpt.md
|
||||
- DuckDuckGo: tools/duckduckgo.md
|
||||
- Langchain: tools/langchain.md
|
||||
- Firecrawl: firecrawl.md
|
||||
- Wikipedia: wikipedia.md
|
||||
- YouTube: youtube.md
|
||||
- Tavily: tavily.md
|
||||
- Reddit: reddit.md
|
||||
- You.com: you.com.md
|
||||
- Crawl4AI: docs/crawl4ai.md
|
||||
- Wikipedia: tools/wikipedia.md
|
||||
- YouTube: tools/youtube.md
|
||||
- Tavily: tools/tavily.md
|
||||
- Reddit: tools/reddit.md
|
||||
- You.com: tools/you.com.md
|
||||
- Crawl4AI: tools/crawl4ai.md
|
||||
|
||||
- 📊 Monitoring:
|
||||
- AgentOps: monitoring/agentops.md
|
||||
|
||||
- 📚 Developers:
|
||||
- Test: test.md
|
||||
@@ -37,7 +54,7 @@ nav:
|
||||
- Deploy: deploy.md
|
||||
|
||||
- 🤗 Contributing:
|
||||
- Home: contributing.md
|
||||
- Contribute: contributing.md
|
||||
|
||||
- 🛠️ API reference:
|
||||
- API: api.md
|
||||
|
||||
@@ -47,7 +47,7 @@ def disable_crewai_telemetry():
|
||||
disable_crewai_telemetry()
|
||||
|
||||
class AgentsGenerator:
|
||||
def __init__(self, agent_file, framework, config_list, log_level=None, agent_callback=None, task_callback=None):
|
||||
def __init__(self, agent_file, framework, config_list, log_level=None, agent_callback=None, task_callback=None, agent_yaml=None):
|
||||
"""
|
||||
Initialize the AgentsGenerator object.
|
||||
|
||||
@@ -58,6 +58,7 @@ class AgentsGenerator:
|
||||
log_level (int, optional): The logging level to use. Defaults to logging.INFO.
|
||||
agent_callback (callable, optional): A callback function to be executed after each agent step.
|
||||
task_callback (callable, optional): A callback function to be executed after each tool run.
|
||||
agent_yaml (str, optional): The content of the YAML file. Defaults to None.
|
||||
|
||||
Attributes:
|
||||
agent_file (str): The path to the agent file.
|
||||
@@ -73,6 +74,7 @@ class AgentsGenerator:
|
||||
self.log_level = log_level
|
||||
self.agent_callback = agent_callback
|
||||
self.task_callback = task_callback
|
||||
self.agent_yaml = agent_yaml
|
||||
self.log_level = log_level or logging.getLogger().getEffectiveLevel()
|
||||
if self.log_level == logging.NOTSET:
|
||||
self.log_level = os.environ.get('LOGLEVEL', 'INFO').upper()
|
||||
@@ -170,14 +172,17 @@ class AgentsGenerator:
|
||||
|
||||
This function first loads the agent configuration from the specified file. It then initializes the tools required for the agents based on the specified framework. If the specified framework is "autogen", it loads the LLM configuration dynamically and creates an AssistantAgent for each role in the configuration. It then adds tools to the agents if specified in the configuration. Finally, it prepares tasks for the agents based on the configuration and initiates the tasks using the crew of agents. If the specified framework is not "autogen", it creates a crew of agents and initiates tasks based on the configuration.
|
||||
"""
|
||||
if self.agent_file == '/app/api:app' or self.agent_file == 'api:app':
|
||||
self.agent_file = 'agents.yaml'
|
||||
try:
|
||||
with open(self.agent_file, 'r') as f:
|
||||
config = yaml.safe_load(f)
|
||||
except FileNotFoundError:
|
||||
print(f"File not found: {self.agent_file}")
|
||||
return
|
||||
if self.agent_yaml:
|
||||
config = yaml.safe_load(self.agent_yaml)
|
||||
else:
|
||||
if self.agent_file == '/app/api:app' or self.agent_file == 'api:app':
|
||||
self.agent_file = 'agents.yaml'
|
||||
try:
|
||||
with open(self.agent_file, 'r') as f:
|
||||
config = yaml.safe_load(f)
|
||||
except FileNotFoundError:
|
||||
print(f"File not found: {self.agent_file}")
|
||||
return
|
||||
|
||||
topic = config['topic']
|
||||
tools_dict = {
|
||||
|
||||
@@ -29,7 +29,7 @@ except ImportError:
|
||||
GRADIO_AVAILABLE = False
|
||||
|
||||
class PraisonAI:
|
||||
def __init__(self, agent_file="agents.yaml", framework="", auto=False, init=False):
|
||||
def __init__(self, agent_file="agents.yaml", framework="", auto=False, init=False, agent_yaml=None):
|
||||
"""
|
||||
Initialize the PraisonAI object with default parameters.
|
||||
|
||||
@@ -45,7 +45,9 @@ class PraisonAI:
|
||||
framework (str): The framework to use.
|
||||
auto (bool): A flag indicating whether to enable auto mode.
|
||||
init (bool): A flag indicating whether to enable initialization mode.
|
||||
agent_yaml (str, optional): The content of the YAML file. Defaults to None.
|
||||
"""
|
||||
self.agent_yaml = agent_yaml
|
||||
self.config_list = [
|
||||
{
|
||||
'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4o"),
|
||||
@@ -121,11 +123,11 @@ class PraisonAI:
|
||||
self.create_chainlit_interface()
|
||||
else:
|
||||
# Modify below code to allow default ui
|
||||
agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
|
||||
agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list, agent_yaml=self.agent_yaml)
|
||||
result = agents_generator.generate_crew_and_kickoff()
|
||||
return result
|
||||
else:
|
||||
agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list)
|
||||
agents_generator = AgentsGenerator(self.agent_file, self.framework, self.config_list, agent_yaml=self.agent_yaml)
|
||||
result = agents_generator.generate_crew_and_kickoff()
|
||||
return result
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class CloudDeployer:
|
||||
file.write("FROM python:3.11-slim\n")
|
||||
file.write("WORKDIR /app\n")
|
||||
file.write("COPY . .\n")
|
||||
file.write("RUN pip install flask praisonai==0.0.38 gunicorn markdown\n")
|
||||
file.write("RUN pip install flask praisonai==0.0.39 gunicorn markdown\n")
|
||||
file.write("EXPOSE 8080\n")
|
||||
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "PraisonAI"
|
||||
version = "0.0.38"
|
||||
version = "0.0.39"
|
||||
description = "PraisonAI application combines AutoGen and CrewAI or similar frameworks into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration."
|
||||
authors = ["Mervin Praison"]
|
||||
license = ""
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import os
|
||||
import yaml
|
||||
from praisonai.cli import PraisonAI
|
||||
|
||||
# Example agent_yaml content
|
||||
agent_yaml = """
|
||||
framework: "crewai"
|
||||
topic: "Space Exploration"
|
||||
|
||||
roles:
|
||||
astronomer:
|
||||
role: "Space Researcher"
|
||||
goal: "Discover new insights about {topic}"
|
||||
backstory: "You are a curious and dedicated astronomer with a passion for unraveling the mysteries of the cosmos."
|
||||
tasks:
|
||||
investigate_exoplanets:
|
||||
description: "Research and compile information about exoplanets discovered in the last decade."
|
||||
expected_output: "A summarized report on exoplanet discoveries, including their size, potential habitability, and distance from Earth."
|
||||
"""
|
||||
|
||||
# Create a PraisonAI instance with the agent_yaml content
|
||||
praison_ai = PraisonAI(agent_yaml=agent_yaml)
|
||||
|
||||
# Run PraisonAI
|
||||
result = praison_ai.main()
|
||||
|
||||
# Print the result
|
||||
print(result)
|
||||