Skip to content

Commit

Permalink
community: Add OpenGradient integration (Toolkit) (#30190)
Browse files Browse the repository at this point in the history
Commandeering #30135

---------

Co-authored-by: kylexqian <[email protected]>
  • Loading branch information
ccurme and kylexqian authored Mar 9, 2025
1 parent b209d46 commit 67aff16
Show file tree
Hide file tree
Showing 4 changed files with 490 additions and 1 deletion.
138 changes: 138 additions & 0 deletions docs/docs/integrations/providers/opengradient.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"sidebar_label: OpenGradient\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# OpenGradient\n",
"[OpenGradient](https://www.opengradient.ai/) is a decentralized AI computing network enabling globally accessible, permissionless, and verifiable ML model inference.\n",
"\n",
"The OpenGradient langchain package currently offers a toolkit that allows developers to build their own custom ML inference tools for models on the OpenGradient network. This was previously a challenge because of the context-window polluting nature of large model parameters -- imagine having to give your agent a 200x200 array of floating-point data!\n",
"\n",
"The toolkit solves this problem by encapsulating all data processing logic within the tool definition itself. This approach keeps the agent's context window clean while giving developers complete flexibility to implement custom data processing and live-data retrieval for their ML models."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Installation and Setup\n",
"Ensure that you have an OpenGradient API key in order to access the OpenGradient network. If you already have an API key, simply set the environment variable:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [],
"source": [
"!export OPENGRADIENT_PRIVATE_KEY=\"your-api-key\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you need to set up a new API key, download the opengradient SDK and follow the instructions to initialize a new configuration."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "shellscript"
}
},
"outputs": [],
"source": [
"!pip install opengradient\n",
"!opengradient config init"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Once you have set up your API key, install the langchain-opengradient package."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "powershell"
}
},
"outputs": [],
"source": [
"pip install -U langchain-opengradient"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## OpenGradient Toolkit\n",
"The OpenGradientToolkit empowers developers to create specialized tools based on [ML models](https://hub.opengradient.ai/models) and [workflows](https://docs.opengradient.ai/developers/sdk/ml_workflows.html) deployed on the OpenGradient decentralized network. This integration enables LangChain agents to access powerful ML capabilities while maintaining efficient context usage.\n",
"\n",
"### Key Benefits\n",
"* πŸ”„ Real-time data integration - Process live data feeds within your tools\n",
"\n",
"* 🎯 Dynamic processing - Custom data pipelines that adapt to specific agent inputs\n",
"\n",
"* 🧠 Context efficiency - Handle complex ML operations without flooding your context window\n",
"\n",
"* πŸ”Œ Seamless deployment - Easy integration with models already on the OpenGradient network\n",
"\n",
"* πŸ”§ Full customization - Create and deploy your own specific models through the [OpenGradient SDK](https://docs.opengradient.ai/developers/sdk/model_management.html), then build custom tools from them\n",
"\n",
"* πŸ” Verifiable inference - All inferences run on the decentralized OpenGradient network, allowing users to choose various flavors of security such as ZKML and TEE for trustless, verifiable model execution\n",
"\n",
"For detailed examples and implementation guides, check out our [comprehensive tutorial](/docs/integrations/tools/opengradient_toolkit.ipynb)."
]
}
],
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Loading

0 comments on commit 67aff16

Please sign in to comment.