Skip to content

Commit 6dca0fd

Browse files
Merge pull request #68 from MervinPraison/develop
v0.0.39 Pass Raw Agents YAML Content instead of agents.yaml file
2 parents 36ece39 + 42e87ed commit 6dca0fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+813
-68
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.11-slim
22
WORKDIR /app
33
COPY . .
4-
RUN pip install flask praisonai==0.0.38 gunicorn markdown
4+
RUN pip install flask praisonai==0.0.39 gunicorn markdown
55
EXPOSE 8080
66
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]

agents.yaml

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,42 @@
11
framework: autogen
2-
topic: research about the causes of lung disease
2+
topic: create movie script about cat in mars
33
roles:
4-
research_analyst:
5-
backstory: Experienced in analyzing scientific data related to respiratory health.
6-
goal: Analyze data on lung diseases
7-
role: Research Analyst
4+
researcher:
5+
backstory: Skilled in finding relevant information from various sources, with
6+
a focus on accuracy.
7+
goal: Gather information about cats and Mars
8+
role: Researcher
89
tasks:
9-
data_analysis:
10-
description: Gather and analyze data on the causes and risk factors of lung
11-
diseases.
12-
expected_output: Report detailing key findings on lung disease causes.
10+
information_gathering:
11+
description: Gather information about cats, their behavior, and Mars, including
12+
its environment and potential for life.
13+
expected_output: Document with research findings, including cat behavior,
14+
Mars environment, and potential for life.
1315
tools:
14-
- 'InternetSearchTool'
15-
medical_writer:
16-
backstory: Skilled in translating complex medical information into accessible
17-
content.
18-
goal: Compile comprehensive content on lung disease causes
19-
role: Medical Writer
16+
- ''
17+
world_builder:
18+
backstory: Expert in building immersive worlds, with a focus on detail and consistency.
19+
goal: Create a rich world for the movie script
20+
role: World Builder
2021
tasks:
21-
content_creation:
22-
description: Create detailed content summarizing the research findings on
23-
lung disease causes.
24-
expected_output: Document outlining various causes and risk factors of lung
25-
diseases.
22+
world_creation:
23+
description: Create a rich world for the movie script, including the Martian
24+
environment, cat behavior, and other essential elements.
25+
expected_output: Document with detailed world-building information, including
26+
Martian environment, cat behavior, and other essential elements.
2627
tools:
2728
- ''
28-
editor:
29-
backstory: Proficient in editing medical content for accuracy and clarity.
30-
goal: Review and refine content on lung disease causes
31-
role: Editor
29+
screenwriter:
30+
backstory: Skilled in writing engaging movie scripts, with a focus on storytelling
31+
and character development.
32+
goal: Write a movie script about a cat in Mars
33+
role: Screenwriter
3234
tasks:
33-
content_review:
34-
description: Edit and refine the compiled content on lung disease causes for
35-
accuracy and coherence.
36-
expected_output: Finalized document on lung disease causes ready for dissemination.
35+
scriptwriting_task:
36+
description: Write a movie script about a cat in Mars, incorporating the research
37+
findings and world-building information.
38+
expected_output: Production-ready movie script with dialogue, scenes, and
39+
a compelling story.
3740
tools:
3841
- ''
39-
dependencies: []
42+
dependencies: []

docs/api/praisonai/agents_generator.html

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ <h2 id="attributes">Attributes</h2>
258258
# print(self.config_list)
259259
llm_config = {&#34;config_list&#34;: self.config_list}
260260

261+
if agentops_exists:
262+
agentops.init(os.environ.get(&#34;AGENTOPS_API_KEY&#34;), tags=[&#34;autogen&#34;])
261263
# Assuming the user proxy agent is set up as per your requirements
262264
user_proxy = autogen.UserProxyAgent(
263265
name=&#34;User&#34;,
@@ -301,18 +303,54 @@ <h2 id="attributes">Attributes</h2>
301303
# Additional fields like carryover can be added based on dependencies
302304
}
303305
tasks.append(chat_task)
304-
305306
response = user_proxy.initiate_chats(tasks)
306307
result = &#34;### Output ###\n&#34;+response[-1].summary if hasattr(response[-1], &#39;summary&#39;) else &#34;&#34;
307-
else:
308+
if agentops_exists:
309+
agentops.end_session(&#34;Success&#34;)
310+
else: # framework=crewai
311+
if agentops_exists:
312+
agentops.init(os.environ.get(&#34;AGENTOPS_API_KEY&#34;), tags=[&#34;crewai&#34;])
308313
for role, details in config[&#39;roles&#39;].items():
309314
role_filled = details[&#39;role&#39;].format(topic=topic)
310315
goal_filled = details[&#39;goal&#39;].format(topic=topic)
311316
backstory_filled = details[&#39;backstory&#39;].format(topic=topic)
312317

313318
# Adding tools to the agent if exists
314319
agent_tools = [tools_dict[tool] for tool in details.get(&#39;tools&#39;, []) if tool in tools_dict]
315-
agent = Agent(role=role_filled, goal=goal_filled, backstory=backstory_filled, tools=agent_tools, allow_delegation=False)
320+
321+
llm_model = details.get(&#39;llm&#39;) # Get the llm configuration
322+
if llm_model:
323+
llm = PraisonAIModel(
324+
model=llm_model.get(&#34;model&#34;, os.environ.get(&#34;MODEL_NAME&#34;, &#34;openai/gpt-4o&#34;)),
325+
).get_model()
326+
else:
327+
llm = PraisonAIModel().get_model()
328+
329+
function_calling_llm_model = details.get(&#39;function_calling_llm&#39;)
330+
if function_calling_llm_model:
331+
function_calling_llm = PraisonAIModel(
332+
model=function_calling_llm_model.get(&#34;model&#34;, os.environ.get(&#34;MODEL_NAME&#34;, &#34;openai/gpt-4o&#34;)),
333+
).get_model()
334+
else:
335+
function_calling_llm = PraisonAIModel().get_model()
336+
337+
agent = Agent(
338+
role=role_filled,
339+
goal=goal_filled,
340+
backstory=backstory_filled,
341+
tools=agent_tools,
342+
allow_delegation=details.get(&#39;allow_delegation&#39;, False),
343+
llm=llm,
344+
function_calling_llm=function_calling_llm,
345+
max_iter=details.get(&#39;max_iter&#39;, 15),
346+
max_rpm=details.get(&#39;max_rpm&#39;),
347+
max_execution_time=details.get(&#39;max_execution_time&#39;),
348+
verbose=details.get(&#39;verbose&#39;, True),
349+
cache=details.get(&#39;cache&#39;, True),
350+
system_template=details.get(&#39;system_template&#39;),
351+
prompt_template=details.get(&#39;prompt_template&#39;),
352+
response_template=details.get(&#39;response_template&#39;),
353+
)
316354

317355
# Set agent callback if provided
318356
if self.agent_callback:
@@ -331,22 +369,21 @@ <h2 id="attributes">Attributes</h2>
331369
task.callback = self.task_callback
332370

333371
tasks.append(task)
334-
if agentops:
335-
agentops.init()
372+
336373
crew = Crew(
337374
agents=list(agents.values()),
338375
tasks=tasks,
339376
verbose=2
340377
)
341-
if agentops:
342-
agentops.end_session(&#34;Success&#34;)
343378

344379
self.logger.debug(&#34;Final Crew Configuration:&#34;)
345380
self.logger.debug(f&#34;Agents: {crew.agents}&#34;)
346381
self.logger.debug(f&#34;Tasks: {crew.tasks}&#34;)
347382

348383
response = crew.kickoff()
349384
result = f&#34;### Task Output ###\n{response}&#34;
385+
if agentops_exists:
386+
agentops.end_session(&#34;Success&#34;)
350387
return result</code></pre>
351388
</details>
352389
<h3>Methods</h3>

docs/api/praisonai/auto.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ <h2 id="usage">Usage</h2>
295295
<span>(</span><span>**data: Any)</span>
296296
</code></dt>
297297
<dd>
298-
<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>
298+
<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>
299299
<p>A base class for creating Pydantic models.</p>
300300
<h2 id="attributes">Attributes</h2>
301301
<dl>
@@ -395,7 +395,7 @@ <h3>Class variables</h3>
395395
<span>(</span><span>**data: Any)</span>
396396
</code></dt>
397397
<dd>
398-
<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>
398+
<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>
399399
<p>A base class for creating Pydantic models.</p>
400400
<h2 id="attributes">Attributes</h2>
401401
<dl>
@@ -480,7 +480,7 @@ <h3>Class variables</h3>
480480
<span>(</span><span>**data: Any)</span>
481481
</code></dt>
482482
<dd>
483-
<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>
483+
<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>
484484
<p>A base class for creating Pydantic models.</p>
485485
<h2 id="attributes">Attributes</h2>
486486
<dl>

docs/api/praisonai/deploy.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ <h2 id="raises">Raises</h2>
110110
file.write(&#34;FROM python:3.11-slim\n&#34;)
111111
file.write(&#34;WORKDIR /app\n&#34;)
112112
file.write(&#34;COPY . .\n&#34;)
113-
file.write(&#34;RUN pip install flask praisonai==0.0.38 gunicorn markdown\n&#34;)
113+
file.write(&#34;RUN pip install flask praisonai==0.0.39 gunicorn markdown\n&#34;)
114114
file.write(&#34;EXPOSE 8080\n&#34;)
115115
file.write(&#39;CMD [&#34;gunicorn&#34;, &#34;-b&#34;, &#34;0.0.0.0:8080&#34;, &#34;api:app&#34;]\n&#39;)
116116

docs/api/praisonai/inc/index.html

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
6+
<meta name="generator" content="pdoc3 0.11.1">
7+
<title>praisonai.inc API documentation</title>
8+
<meta name="description" content="">
9+
<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>
10+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin>
11+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin>
12+
<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>
13+
<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>
14+
<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>
15+
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script>
16+
<script>window.addEventListener('DOMContentLoaded', () => {
17+
hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']});
18+
hljs.highlightAll();
19+
})</script>
20+
</head>
21+
<body>
22+
<main>
23+
<article id="content">
24+
<header>
25+
<h1 class="title">Module <code>praisonai.inc</code></h1>
26+
</header>
27+
<section id="section-intro">
28+
</section>
29+
<section>
30+
<h2 class="section-title" id="header-submodules">Sub-modules</h2>
31+
<dl>
32+
<dt><code class="name"><a title="praisonai.inc.models" href="models.html">praisonai.inc.models</a></code></dt>
33+
<dd>
34+
<div class="desc"></div>
35+
</dd>
36+
</dl>
37+
</section>
38+
<section>
39+
</section>
40+
<section>
41+
</section>
42+
<section>
43+
</section>
44+
</article>
45+
<nav id="sidebar">
46+
<div class="toc">
47+
<ul></ul>
48+
</div>
49+
<ul id="index">
50+
<li><h3>Super-module</h3>
51+
<ul>
52+
<li><code><a title="praisonai" href="../index.html">praisonai</a></code></li>
53+
</ul>
54+
</li>
55+
<li><h3><a href="#header-submodules">Sub-modules</a></h3>
56+
<ul>
57+
<li><code><a title="praisonai.inc.models" href="models.html">praisonai.inc.models</a></code></li>
58+
</ul>
59+
</li>
60+
</ul>
61+
</nav>
62+
</main>
63+
<footer id="footer">
64+
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.1</a>.</p>
65+
</footer>
66+
</body>
67+
</html>

0 commit comments

Comments
 (0)