Name | autogen-watsonx-client JSON |
Version |
0.0.3
JSON |
| download |
home_page | None |
Summary | This is an autogen>=0.4 extension for watsonx client integration. |
upload_time | 2024-12-09 04:09:47 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <3.13,>=3.10 |
license | MIT License Copyright (c) 2024 tsinggggg Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
autogen
agent
ai
watsonx
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# autogen-watsonx-client
This is an autogen>=0.4 extension for watsonx client integration.
## Disclaimer
- This is a community extension for the [Autogen](https://github.com/microsoft/autogen) project, specifically for the new [Autogen](https://microsoft.github.io/autogen/0.2/blog/2024/10/02/new-autogen-architecture-preview) architecture. The goal is to support IBM Watsonx.ai hosted LLMs in the Autogen framework.
- This project is still in a very early stage under development, please create issues in this github repo for bug reports.
- This project is a personal endeavor and is not affiliated with, endorsed by, or connected to any organization/employer in any way. The views, ideas, and opinions expressed in this project are solely my own and do not reflect those of others.
## Usage
### Prerequisites
- create a python environment with version `3.10` or above
- `pip install --upgrade autogen-watsonx-client`
- `pip install --upgrade autogen-agentchat>=0.4 --pre`
- access to a watsonx.ai instance, setting up environment variables `WATSONX_API_KEY`, one of `WATSONX_SPACE_ID` or `WATSONX_PROJECT_ID`, optionally `WATSONX_URL`
### code snippets
Importing dependencies:
```python
import os
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.task import Console, TextMentionTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_watsonx_client.client import WatsonXChatCompletionClient
from autogen_watsonx_client.config import WatsonxClientConfiguration
```
Create a watsonx client
```python
wx_config = WatsonxClientConfiguration(
model_id="meta-llama/llama-3-2-90b-vision-instruct", # pick a model you have access to on wx.ai here
api_key=os.environ.get("WATSONX_API_KEY"),
url=os.environ.get("WATSONX_URL"),
space_id=os.environ.get("WATSONX_SPACE_ID"),
project_id=os.environ.get("WATSONX_PROJECT_ID"),
)
wx_client = WatsonXChatCompletionClient(**wx_config)
```
Define an agent using the watsonx client and register a dummy tool for querying weather
```python
# Define a tool
async def get_weather(city: str) -> str:
return f"The weather in {city} is 73 degrees and Sunny."
async def main() -> None:
# Define an agent
weather_agent = AssistantAgent(
name="weather_agent",
model_client=wx_client,
tools=[get_weather],
)
# Define termination condition
termination = TextMentionTermination("TERMINATE")
# Define a team
agent_team = RoundRobinGroupChat([weather_agent], termination_condition=termination)
# Run the team and stream messages to the console
stream = agent_team.run_stream(task="What is the weather in New York?")
await Console(stream)
# NOTE: if running this inside a Python script you'll need to use asyncio.run(main()).
await main()
```
Refer to [here](doc/README.md) for more detailed examples.
Raw data
{
"_id": null,
"home_page": null,
"name": "autogen-watsonx-client",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.10",
"maintainer_email": null,
"keywords": "autogen, agent, AI, watsonx",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/e7/8f/fc6e96f9a11daae417477fadc35135d2c0b8f614a235f13dfca21e02411f/autogen_watsonx_client-0.0.3.tar.gz",
"platform": null,
"description": "# autogen-watsonx-client\nThis is an autogen>=0.4 extension for watsonx client integration.\n\n\n## Disclaimer\n- This is a community extension for the [Autogen](https://github.com/microsoft/autogen) project, specifically for the new [Autogen](https://microsoft.github.io/autogen/0.2/blog/2024/10/02/new-autogen-architecture-preview) architecture. The goal is to support IBM Watsonx.ai hosted LLMs in the Autogen framework.\n- This project is still in a very early stage under development, please create issues in this github repo for bug reports.\n- This project is a personal endeavor and is not affiliated with, endorsed by, or connected to any organization/employer in any way. The views, ideas, and opinions expressed in this project are solely my own and do not reflect those of others.\n\n## Usage\n\n### Prerequisites\n- create a python environment with version `3.10` or above\n- `pip install --upgrade autogen-watsonx-client`\n- `pip install --upgrade autogen-agentchat>=0.4 --pre`\n- access to a watsonx.ai instance, setting up environment variables `WATSONX_API_KEY`, one of `WATSONX_SPACE_ID` or `WATSONX_PROJECT_ID`, optionally `WATSONX_URL`\n\n\n### code snippets\n\nImporting dependencies:\n\n```python\nimport os\n\nfrom autogen_agentchat.agents import AssistantAgent\nfrom autogen_agentchat.task import Console, TextMentionTermination\nfrom autogen_agentchat.teams import RoundRobinGroupChat\nfrom autogen_watsonx_client.client import WatsonXChatCompletionClient\nfrom autogen_watsonx_client.config import WatsonxClientConfiguration\n```\n\nCreate a watsonx client\n\n```python\nwx_config = WatsonxClientConfiguration(\n model_id=\"meta-llama/llama-3-2-90b-vision-instruct\", # pick a model you have access to on wx.ai here\n api_key=os.environ.get(\"WATSONX_API_KEY\"),\n url=os.environ.get(\"WATSONX_URL\"),\n space_id=os.environ.get(\"WATSONX_SPACE_ID\"),\n project_id=os.environ.get(\"WATSONX_PROJECT_ID\"),\n)\n\nwx_client = WatsonXChatCompletionClient(**wx_config)\n```\n\nDefine an agent using the watsonx client and register a dummy tool for querying weather\n\n```python\n# Define a tool\nasync def get_weather(city: str) -> str:\n return f\"The weather in {city} is 73 degrees and Sunny.\"\n\n\nasync def main() -> None:\n # Define an agent\n weather_agent = AssistantAgent(\n name=\"weather_agent\",\n model_client=wx_client,\n tools=[get_weather],\n )\n\n # Define termination condition\n termination = TextMentionTermination(\"TERMINATE\")\n\n # Define a team\n agent_team = RoundRobinGroupChat([weather_agent], termination_condition=termination)\n\n # Run the team and stream messages to the console\n stream = agent_team.run_stream(task=\"What is the weather in New York?\")\n await Console(stream)\n\n\n# NOTE: if running this inside a Python script you'll need to use asyncio.run(main()).\nawait main()\n```\n\nRefer to [here](doc/README.md) for more detailed examples.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 tsinggggg Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "This is an autogen>=0.4 extension for watsonx client integration.",
"version": "0.0.3",
"project_urls": null,
"split_keywords": [
"autogen",
" agent",
" ai",
" watsonx"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fe44483bc4924c7f371e4a6b0b409d7f7e153f3de5d04cf342b8295f2cca04c6",
"md5": "dbcf645333dd681bab9b03eef8aeda56",
"sha256": "62d1ead5aab8e630a6363b7f1366db87a2fd8d2feba5a86f7721fa14517dd396"
},
"downloads": -1,
"filename": "autogen_watsonx_client-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dbcf645333dd681bab9b03eef8aeda56",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.10",
"size": 7606,
"upload_time": "2024-12-09T04:09:45",
"upload_time_iso_8601": "2024-12-09T04:09:45.829921Z",
"url": "https://files.pythonhosted.org/packages/fe/44/483bc4924c7f371e4a6b0b409d7f7e153f3de5d04cf342b8295f2cca04c6/autogen_watsonx_client-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e78ffc6e96f9a11daae417477fadc35135d2c0b8f614a235f13dfca21e02411f",
"md5": "2a5741a17f6961e9a922870ffd4b4e18",
"sha256": "1df385cb5a2d6426620dc35a0557b741b2790b4034afa707a78b73f457c2dd19"
},
"downloads": -1,
"filename": "autogen_watsonx_client-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "2a5741a17f6961e9a922870ffd4b4e18",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.10",
"size": 6244,
"upload_time": "2024-12-09T04:09:47",
"upload_time_iso_8601": "2024-12-09T04:09:47.316816Z",
"url": "https://files.pythonhosted.org/packages/e7/8f/fc6e96f9a11daae417477fadc35135d2c0b8f614a235f13dfca21e02411f/autogen_watsonx_client-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 04:09:47",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "autogen-watsonx-client"
}