Skip to content

Commit df39c5b

Browse files
Merge pull request #69 from MervinPraison/develop
v0.0.39 Adding Support to OpenRouter
2 parents 0a2b585 + f640f90 commit df39c5b

File tree

15 files changed

+843
-55
lines changed

15 files changed

+843
-55
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.39 gunicorn markdown
4+
RUN pip install flask praisonai==0.0.40 gunicorn markdown
55
EXPOSE 8080
66
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]

cookbooks/praisonai-googlecolab.ipynb

Lines changed: 257 additions & 0 deletions
Large diffs are not rendered by default.

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.39 gunicorn markdown\n&#34;)
113+
file.write(&#34;RUN pip install flask praisonai==0.0.40 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

File renamed without changes.
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
---
2+
jupyter:
3+
accelerator: GPU
4+
colab:
5+
gpuType: T4
6+
kernelspec:
7+
display_name: Python 3
8+
name: python3
9+
language_info:
10+
name: python
11+
nbformat: 4
12+
nbformat_minor: 0
13+
---
14+
15+
``` python
16+
!pip install -Uq praisonai duckduckgo_search
17+
```
18+
19+
``` python
20+
from duckduckgo_search import DDGS
21+
from praisonai_tools import BaseTool
22+
23+
class InternetSearchTool(BaseTool):
24+
name: str = "InternetSearchTool"
25+
description: str = "Search Internet for relevant information based on a query or latest news"
26+
27+
def _run(self, query: str):
28+
ddgs = DDGS()
29+
results = ddgs.text(keywords=query, region='wt-wt', safesearch='moderate', max_results=5)
30+
return results
31+
```
32+
33+
``` python
34+
import os
35+
import yaml
36+
from praisonai import PraisonAI
37+
from google.colab import userdata
38+
39+
# Example agent_yaml content
40+
agent_yaml = """
41+
framework: "crewai"
42+
topic: "Space Exploration"
43+
44+
roles:
45+
astronomer:
46+
role: "Space Researcher"
47+
goal: "Discover new insights about {topic}"
48+
backstory: "You are a curious and dedicated astronomer with a passion for unraveling the mysteries of the cosmos."
49+
tasks:
50+
investigate_exoplanets:
51+
description: "Research and compile information about exoplanets discovered in the last decade."
52+
expected_output: "A summarized report on exoplanet discoveries, including their size, potential habitability, and distance from Earth."
53+
tools:
54+
- "InternetSearchTool"
55+
"""
56+
57+
# Create a PraisonAI instance with the agent_yaml content
58+
praison_ai = PraisonAI(agent_yaml=agent_yaml)
59+
60+
# Add OPENAI_API_KEY Secrets to Google Colab on the Left Hand Side 🔑 or Enter Manually Below
61+
os.environ["OPENAI_API_KEY"] = userdata.get('OPENAI_API_KEY') or "ENTER OPENAI_API_KEY HERE"
62+
63+
# Run PraisonAI
64+
result = praison_ai.main()
65+
66+
# Print the result
67+
print(result)
68+
```
69+
70+
71+
[2024-07-03 04:53:48][DEBUG]: == Working Agent: Space Researcher
72+
[2024-07-03 04:53:48][INFO]: == Starting Task: Research and compile information about exoplanets discovered in the last decade.
73+
74+
75+
> Entering new CrewAgentExecutor chain...
76+
I now can give a great answer.
77+
78+
Final Answer:
79+
80+
Over the last decade, the field of exoplanet research has experienced significant advancements, leading to the discovery of thousands of exoplanets. These discoveries have been made possible through missions like NASA's Kepler and TESS (Transiting Exoplanet Survey Satellite), as well as ground-based observatories. Here is a summarized report on some of the notable exoplanet discoveries, including their size, potential habitability, and distance from Earth:
81+
82+
1. **Kepler-452b**
83+
- **Size**: Approximately 1.6 times the radius of Earth
84+
- **Potential Habitability**: Located in the habitable zone of its star, where liquid water could exist. It is often referred to as Earth's "cousin."
85+
- **Distance from Earth**: About 1,400 light-years
86+
87+
2. **Proxima Centauri b**
88+
- **Size**: About 1.17 times the mass of Earth
89+
- **Potential Habitability**: Located in the habitable zone of Proxima Centauri, the closest star to the Sun. It has the potential to have liquid water.
90+
- **Distance from Earth**: 4.24 light-years
91+
92+
3. **TRAPPIST-1 System**
93+
- **Size**: The system includes seven Earth-sized planets
94+
- **Potential Habitability**: Three of the planets (TRAPPIST-1e, TRAPPIST-1f, and TRAPPIST-1g) are located in the habitable zone and could potentially support liquid water.
95+
- **Distance from Earth**: Approximately 39 light-years
96+
97+
4. **LHS 1140b**
98+
- **Size**: About 1.4 times the size of Earth and 6.6 times its mass
99+
- **Potential Habitability**: Located in the habitable zone of its star. It has a thick atmosphere and conditions that could support life.
100+
- **Distance from Earth**: About 40 light-years
101+
102+
5. **Kepler-186f**
103+
- **Size**: Similar to Earth in size
104+
- **Potential Habitability**: The first Earth-sized planet discovered in the habitable zone of another star. It has potential for liquid water on its surface.
105+
- **Distance from Earth**: About 500 light-years
106+
107+
6. **K2-18b**
108+
- **Size**: Approximately 2.6 times the radius of Earth
109+
- **Potential Habitability**: Located in the habitable zone of its star, with evidence of water vapor in its atmosphere.
110+
- **Distance from Earth**: About 124 light-years
111+
112+
7. **GJ 357 d**
113+
- **Size**: About 6.1 times the mass of Earth
114+
- **Potential Habitability**: Located in the habitable zone of its star, with the potential to have liquid water on its surface.
115+
- **Distance from Earth**: About 31 light-years
116+
117+
These discoveries highlight the diversity of exoplanets in terms of size, composition, and potential habitability. The search for exoplanets is crucial for understanding the potential for life beyond Earth and the formation and evolution of planetary systems. Ongoing and future missions, such as the James Webb Space Telescope, are expected to provide even more detailed information about these distant worlds.
118+
119+
The continuous exploration and study of exoplanets will undoubtedly lead to new insights and perhaps even the discovery of life beyond our solar system.
120+
121+
122+
123+
> Finished chain.
124+
[2024-07-03 04:53:58][DEBUG]: == [Space Researcher] Task output: Over the last decade, the field of exoplanet research has experienced significant advancements, leading to the discovery of thousands of exoplanets. These discoveries have been made possible through missions like NASA's Kepler and TESS (Transiting Exoplanet Survey Satellite), as well as ground-based observatories. Here is a summarized report on some of the notable exoplanet discoveries, including their size, potential habitability, and distance from Earth:
125+
126+
1. **Kepler-452b**
127+
- **Size**: Approximately 1.6 times the radius of Earth
128+
- **Potential Habitability**: Located in the habitable zone of its star, where liquid water could exist. It is often referred to as Earth's "cousin."
129+
- **Distance from Earth**: About 1,400 light-years
130+
131+
2. **Proxima Centauri b**
132+
- **Size**: About 1.17 times the mass of Earth
133+
- **Potential Habitability**: Located in the habitable zone of Proxima Centauri, the closest star to the Sun. It has the potential to have liquid water.
134+
- **Distance from Earth**: 4.24 light-years
135+
136+
3. **TRAPPIST-1 System**
137+
- **Size**: The system includes seven Earth-sized planets
138+
- **Potential Habitability**: Three of the planets (TRAPPIST-1e, TRAPPIST-1f, and TRAPPIST-1g) are located in the habitable zone and could potentially support liquid water.
139+
- **Distance from Earth**: Approximately 39 light-years
140+
141+
4. **LHS 1140b**
142+
- **Size**: About 1.4 times the size of Earth and 6.6 times its mass
143+
- **Potential Habitability**: Located in the habitable zone of its star. It has a thick atmosphere and conditions that could support life.
144+
- **Distance from Earth**: About 40 light-years
145+
146+
5. **Kepler-186f**
147+
- **Size**: Similar to Earth in size
148+
- **Potential Habitability**: The first Earth-sized planet discovered in the habitable zone of another star. It has potential for liquid water on its surface.
149+
- **Distance from Earth**: About 500 light-years
150+
151+
6. **K2-18b**
152+
- **Size**: Approximately 2.6 times the radius of Earth
153+
- **Potential Habitability**: Located in the habitable zone of its star, with evidence of water vapor in its atmosphere.
154+
- **Distance from Earth**: About 124 light-years
155+
156+
7. **GJ 357 d**
157+
- **Size**: About 6.1 times the mass of Earth
158+
- **Potential Habitability**: Located in the habitable zone of its star, with the potential to have liquid water on its surface.
159+
- **Distance from Earth**: About 31 light-years
160+
161+
These discoveries highlight the diversity of exoplanets in terms of size, composition, and potential habitability. The search for exoplanets is crucial for understanding the potential for life beyond Earth and the formation and evolution of planetary systems. Ongoing and future missions, such as the James Webb Space Telescope, are expected to provide even more detailed information about these distant worlds.
162+
163+
The continuous exploration and study of exoplanets will undoubtedly lead to new insights and perhaps even the discovery of life beyond our solar system.
164+
165+
166+
### Task Output ###
167+
Over the last decade, the field of exoplanet research has experienced significant advancements, leading to the discovery of thousands of exoplanets. These discoveries have been made possible through missions like NASA's Kepler and TESS (Transiting Exoplanet Survey Satellite), as well as ground-based observatories. Here is a summarized report on some of the notable exoplanet discoveries, including their size, potential habitability, and distance from Earth:
168+
169+
1. **Kepler-452b**
170+
- **Size**: Approximately 1.6 times the radius of Earth
171+
- **Potential Habitability**: Located in the habitable zone of its star, where liquid water could exist. It is often referred to as Earth's "cousin."
172+
- **Distance from Earth**: About 1,400 light-years
173+
174+
2. **Proxima Centauri b**
175+
- **Size**: About 1.17 times the mass of Earth
176+
- **Potential Habitability**: Located in the habitable zone of Proxima Centauri, the closest star to the Sun. It has the potential to have liquid water.
177+
- **Distance from Earth**: 4.24 light-years
178+
179+
3. **TRAPPIST-1 System**
180+
- **Size**: The system includes seven Earth-sized planets
181+
- **Potential Habitability**: Three of the planets (TRAPPIST-1e, TRAPPIST-1f, and TRAPPIST-1g) are located in the habitable zone and could potentially support liquid water.
182+
- **Distance from Earth**: Approximately 39 light-years
183+
184+
4. **LHS 1140b**
185+
- **Size**: About 1.4 times the size of Earth and 6.6 times its mass
186+
- **Potential Habitability**: Located in the habitable zone of its star. It has a thick atmosphere and conditions that could support life.
187+
- **Distance from Earth**: About 40 light-years
188+
189+
5. **Kepler-186f**
190+
- **Size**: Similar to Earth in size
191+
- **Potential Habitability**: The first Earth-sized planet discovered in the habitable zone of another star. It has potential for liquid water on its surface.
192+
- **Distance from Earth**: About 500 light-years
193+
194+
6. **K2-18b**
195+
- **Size**: Approximately 2.6 times the radius of Earth
196+
- **Potential Habitability**: Located in the habitable zone of its star, with evidence of water vapor in its atmosphere.
197+
- **Distance from Earth**: About 124 light-years
198+
199+
7. **GJ 357 d**
200+
- **Size**: About 6.1 times the mass of Earth
201+
- **Potential Habitability**: Located in the habitable zone of its star, with the potential to have liquid water on its surface.
202+
- **Distance from Earth**: About 31 light-years
203+
204+
These discoveries highlight the diversity of exoplanets in terms of size, composition, and potential habitability. The search for exoplanets is crucial for understanding the potential for life beyond Earth and the formation and evolution of planetary systems. Ongoing and future missions, such as the James Webb Space Telescope, are expected to provide even more detailed information about these distant worlds.
205+
206+
The continuous exploration and study of exoplanets will undoubtedly lead to new insights and perhaps even the discovery of life beyond our solar system.
207+
:::
208+
:::

0 commit comments

Comments
 (0)