grasp_agents 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: grasp_agents
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Grasp Agents Library
5
5
  License-File: LICENSE
6
+ License-File: LICENSE.md
6
7
  Requires-Python: <3.12,>=3.11.4
8
+ Requires-Dist: dotenv>=0.9.9
7
9
  Requires-Dist: httpx<1,>=0.27.0
8
10
  Requires-Dist: openai<2,>=1.68.2
11
+ Requires-Dist: pyyaml>=6.0.2
9
12
  Requires-Dist: tenacity>=9.1.2
10
13
  Requires-Dist: termcolor<3,>=2.4.0
11
14
  Requires-Dist: tqdm<5,>=4.66.2
@@ -20,7 +23,7 @@ Description-Content-Type: text/markdown
20
23
 
21
24
  [![PyPI version](https://badge.fury.io/py/grasp_agents.svg)](https://badge.fury.io/py/grasp_agents)
22
25
  [![Python Versions](https://img.shields.io/pypi/pyversions/grasp_agents?style=flat-square)](https://pypi.org/project/grasp_agents/)
23
- [![License: MIT](https://img.shields.io/badge/license-MIT-yellow?style=flat-square)](LICENSE)
26
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow?style=flat-square)](https://mit-license.org/)
24
27
 
25
28
  ## Overview
26
29
 
@@ -51,6 +54,8 @@ grasp-agents is a modular Python framework for building agentic AI pipelines and
51
54
 
52
55
  ### Option 1: UV Package Manager Project
53
56
 
57
+ > **Note:** You can check this sample project code in the [src/grasp_agents/examples/demo/uv](src/grasp_agents/examples/demo/uv) folder. Feel free to copy and paste the code from there to a separate project.
58
+
54
59
  #### 1. Prerequisites
55
60
 
56
61
  Install the [UV Package Manager](https://github.com/astral-sh/uv):
@@ -85,31 +90,72 @@ uv sync
85
90
 
86
91
  Create a file, e.g., `hello.py`:
87
92
 
93
+ Ensure you have a `.env` file with your OpenAI and Google AI Studio API keys set
94
+
95
+ ```
96
+ OPENAI_API_KEY=your_openai_api_key
97
+ GOOGLE_AI_STUDIO_API_KEY=your_google_ai_studio_api_key
98
+ ```
99
+
88
100
  ```python
101
+ import asyncio
102
+ from typing import Any
103
+
89
104
  from grasp_agents.llm_agent import LLMAgent
90
- from grasp_agents.base_agent import BaseAgentConfig
105
+ from grasp_agents.openai.openai_llm import (
106
+ OpenAILLM,
107
+ OpenAILLMSettings,
108
+ )
109
+ from grasp_agents.typing.io import (
110
+ AgentPayload,
111
+ )
112
+ from grasp_agents.run_context import RunContextWrapper
113
+
114
+ from dotenv import load_dotenv
115
+
116
+ load_dotenv()
117
+
118
+ class Response(AgentPayload):
119
+ response: str
91
120
 
92
- agent = LLMAgent(
93
- config=BaseAgentConfig(
94
- model="gpt-4o-mini",
95
- memory=None, # or your memory implementation
96
- )
121
+
122
+ chatbot = LLMAgent[Any, Response, None](
123
+ agent_id="chatbot",
124
+ llm=OpenAILLM(
125
+ model_name="gpt-4o",
126
+ llm_settings=OpenAILLMSettings(),
127
+ ),
128
+ sys_prompt=None,
129
+ out_schema=Response,
97
130
  )
98
131
 
99
- response = agent.run("Hello, agent!")
100
- print(response)
132
+
133
+ @chatbot.parse_output_handler
134
+ def output_handler(conversation, ctx, **kwargs) -> Response:
135
+ return Response(response=conversation[-1].content)
136
+
137
+
138
+ async def main():
139
+ ctx = RunContextWrapper(print_messages=True)
140
+ out = await chatbot.run("Hello, agent!", ctx=ctx)
141
+ print(out.payloads[0].response)
142
+
143
+
144
+ asyncio.run(main())
101
145
  ```
102
146
 
103
147
  Run your script:
104
148
 
105
149
  ```bash
106
- python hello.py
150
+ uv run hello.py
107
151
  ```
108
152
 
109
153
  ---
110
154
 
111
155
  ### Option 2: PIP-only (requirements.txt-based) Project
112
156
 
157
+ > **Note:** You can check this sample project code in the [src/grasp_agents/examples/demo/pip](src/grasp_agents/examples/demo/pip) folder. Feel free to copy and paste the code from there to a separate project.
158
+
113
159
  #### 1. Create Project Folder
114
160
 
115
161
  ```bash
@@ -168,10 +214,6 @@ python hello.py
168
214
 
169
215
  ---
170
216
 
171
- ## License
172
-
173
- MIT License. See [LICENSE](LICENSE) for details.
174
-
175
217
  ## Development
176
218
 
177
219
  To develop and test the library locally, follow these steps:
@@ -194,10 +236,23 @@ source .venv/bin/activate
194
236
  uv sync
195
237
  ```
196
238
 
197
- ### 3. Test Example
239
+ ### 3. Test Example for VS Code
198
240
 
199
- - Install the Jupyter Notebook extension for VS Code.
200
- - Open `src/grasp_agents/examples/notebooks/agents_demo.ipynb` in VS Code.
201
- - Ensure you have a `.env` file with your OpenAI and Google AI Studio API keys set (see `.env.example`).
241
+ - Install the [Jupyter Notebook extension](https://marketplace.visualstudio.com/items/?itemName=ms-toolsai.jupyter).
242
+
243
+ - Ensure you have a `.env` file with your OpenAI and Google AI Studio API keys set (see [.env.example](.env.example)).
244
+
245
+ ```
246
+ OPENAI_API_KEY=your_openai_api_key
247
+ GOOGLE_AI_STUDIO_API_KEY=your_google_ai_studio_api_key
248
+ ```
249
+
250
+ - Open [src/grasp_agents/examples/notebooks/agents_demo.ipynb](src/grasp_agents/examples/notebooks/agents_demo.ipynb).
202
251
 
203
252
  You're now ready to run and experiment with the example notebook.
253
+
254
+ ### 4. Recommended VS Code Extensions
255
+
256
+ - [Ruff](https://marketplace.visualstudio.com/items/?itemName=charliermarsh.ruff) -- for formatting and code analysis
257
+ - [Pylint](https://marketplace.visualstudio.com/items/?itemName=ms-python.pylint) -- for linting
258
+ - [Pylance](https://marketplace.visualstudio.com/items/?itemName=ms-python.vscode-pylance) -- for type checking
@@ -38,7 +38,8 @@ grasp_agents/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
38
38
  grasp_agents/workflow/looped_agent.py,sha256=YBOgOIvy3_NwKvEoGgzQJ2fY9SNG66MQk6obSBGWvCc,3896
39
39
  grasp_agents/workflow/sequential_agent.py,sha256=yDt2nA-b1leVByD8jsKrWD6bHe0o9z33jrOJGOLwbyk,2004
40
40
  grasp_agents/workflow/workflow_agent.py,sha256=9U94IQ39Vb1W_5u8aoqHb65ikdarEhEJkexDz8xwHD4,2294
41
- grasp_agents-0.1.7.dist-info/METADATA,sha256=NO6iKRFjBeL_PmhnqvjRCsw8Lrw7Ud8okeB_ezEphfk,4413
42
- grasp_agents-0.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
- grasp_agents-0.1.7.dist-info/licenses/LICENSE,sha256=GRDob7--af0SOT8BRgu7Ds1NqhunPyxGjyETcCk-o7s,1062
44
- grasp_agents-0.1.7.dist-info/RECORD,,
41
+ grasp_agents-0.1.9.dist-info/METADATA,sha256=cp5DK_NyWWcd1xqS8msLAoFcATJV6jEsQSJStb_wSbA,6281
42
+ grasp_agents-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
+ grasp_agents-0.1.9.dist-info/licenses/LICENSE,sha256=GRDob7--af0SOT8BRgu7Ds1NqhunPyxGjyETcCk-o7s,1062
44
+ grasp_agents-0.1.9.dist-info/licenses/LICENSE.md,sha256=DkM2HFdRinBoJ6LVBFHvDzJoTjJDYCG7HVe9KO67xy8,965
45
+ grasp_agents-0.1.9.dist-info/RECORD,,
@@ -0,0 +1,11 @@
1
+ Grasp Agents itself is [MIT](https://mit-license.org/)-licensed.
2
+
3
+ Package production dependencies are licensed under the following terms:
4
+
5
+ | Name | Version | License | URL |
6
+ | --------- | ------- | ------------------------------------------------- | --------------------------------------- |
7
+ | httpx | 0.28.1 | BSD License | https://github.com/encode/httpx |
8
+ | openai | 1.77.0 | Apache Software License | https://github.com/openai/openai-python |
9
+ | tenacity | 9.1.2 | Apache Software License | https://github.com/jd/tenacity |
10
+ | termcolor | 2.5.0 | MIT License | https://github.com/termcolor/termcolor |
11
+ | tqdm | 4.67.1 | MIT License; Mozilla Public License 2.0 (MPL 2.0) | https://tqdm.github.io |