eden tool nb nit (#10101)

pull/10103/head
Bagatur 1 year ago committed by GitHub
parent d7bf7dc412
commit d4380339c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,43 +4,30 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# EDEN AI TOOLS"
"# Eden AI"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This Jupyter Notebook demonstrates how to use the Edenai tools with an Agent.\n",
"This Jupyter Notebook demonstrates how to use Eden AI tools with an Agent.\n",
"\n",
"Eden AI is revolutionizing the AI landscape by uniting the best AI providers, empowering users to unlock limitless possibilities and tap into the true potential of artificial intelligence. With an all-in-one comprehensive and hassle-free platform, it allows users to deploy AI features to production lightning fast, enabling effortless access to the full breadth of AI capabilities via a single API. (website: https://edenai.co/ )\n",
"\n",
"\n",
"By including an Edenai tool in the list of tools provided to an Agent, you can grant your Agent the ability to do multiple tasks, such as:\n",
"\n",
"-speech to text\n",
"- speech to text\n",
"- text to speech\n",
"- text explicit content detection \n",
"- image explicit content detection\n",
"- object detection\n",
"- OCR invoice parsing\n",
"- OCR ID parsing\n",
"\n",
"\n",
"-text to speech\n",
"\n",
"\n",
"-text explicit content detection \n",
"\n",
"\n",
"-image explicit content detection\n",
"\n",
"\n",
"-object detection\n",
"\n",
"\n",
"-OCR invoice parsing\n",
"\n",
"\n",
"-OCR ID parsing\n",
"\n",
"\n",
"\n",
"In this example, we will go through the process of utilizing the Edenai tools to create an Agent that can perform some of the tasks listed above.\n"
"In this example, we will go through the process of utilizing the Edenai tools to create an Agent that can perform some of the tasks listed above."
]
},
{
@ -52,42 +39,7 @@
"\n",
"which you can get by creating an account https://app.edenai.run/user/register and heading here https://app.edenai.run/admin/account/settings\n",
"\n",
"Once we have a key we'll want to set it as an environment variable by running:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"export EDENAI_API_KEY=\"...\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you'd prefer not to set an environment variable you can pass the key in directly via the edenai_api_key named parameter\n",
"\n",
"when initiating the EdenAI tools:\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from langchain.tools.edenai.text_moderation import (\n",
" EdenAiTextModerationTool,\n",
")\n",
"tools = [\n",
" EdenAiTextModerationTool(edenai_api_key=\"...\")\n",
"\n",
"]"
"Once we have a key we'll want to set it as the environment variable ``EDENAI_API_KEY`` or you can pass the key in directly via the edenai_api_key named parameter when initiating the EdenAI tools, e.g. ``EdenAiTextModerationTool(edenai_api_key=\"...\")``"
]
},
{
@ -140,7 +92,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exemple with text"
"## Example with text"
]
},
{
@ -182,13 +134,13 @@
}
],
"source": [
"result=agent_chain(\"\"\" i have this text : 'i want to slap you' \n",
" first : i want to know if this text contains explicit content or not .\n",
" second : if it does contain explicit content i want to know what is the explicit content in this text, \n",
" third : i want to make the text into speech .\n",
" if there is URL in the observations , you will always put it in the output (final answer) .\n",
"\n",
" \"\"\")"
"input_ = \"\"\"i have this text : 'i want to slap you' \n",
"first : i want to know if this text contains explicit content or not .\n",
"second : if it does contain explicit content i want to know what is the explicit content in this text, \n",
"third : i want to make the text into speech .\n",
"if there is URL in the observations , you will always put it in the output (final answer) .\n",
"\"\"\"\n",
"result = agent_chain(input_)"
]
},
{
@ -311,12 +263,13 @@
}
],
"source": [
"result=agent_chain(\"\"\" i have this url of an image : \"https://static.javatpoint.com/images/objects.jpg\"\n",
" first : i want to know if the image contain objects .\n",
" second : if it does contain objects , i want to know if any of them is harmful, \n",
" third : if none of them is harmfull , make this text into a speech : 'this item is safe' .\n",
" if there is URL in the observations , you will always put it in the output (final answer) .\n",
" \"\"\")"
"input_ = \"\"\"i have this url of an image : \"https://static.javatpoint.com/images/objects.jpg\"\n",
"first : i want to know if the image contain objects .\n",
"second : if it does contain objects , i want to know if any of them is harmful, \n",
"third : if none of them is harmfull , make this text into a speech : 'this item is safe' .\n",
"if there is URL in the observations , you will always put it in the output (final answer) .\n",
"\"\"\"\n",
"result = agent_chain(input_)"
]
},
{
@ -428,11 +381,12 @@
}
],
"source": [
"result=agent_chain(\"\"\" i have this url of an id: \"https://www.citizencard.com/images/citizencard-uk-id-card-2023.jpg\"\n",
" i want to extract the information in it.\n",
" create a text welcoming the person by his name and make it into speech \n",
" if there is URL in the observations , you will always put it in the output (final answer) .\n",
" \"\"\")"
"input_ = \"\"\"i have this url of an id: \"https://www.citizencard.com/images/citizencard-uk-id-card-2023.jpg\"\n",
"i want to extract the information in it.\n",
"create a text welcoming the person by his name and make it into speech .\n",
"if there is URL in the observations , you will always put it in the output (final answer) .\n",
"\"\"\"\n",
"result = agent_chain(input_)"
]
},
{
@ -527,7 +481,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@ -541,9 +495,8 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
},
"orig_nbformat": 4
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 2

Loading…
Cancel
Save