mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
eden tool nb nit (#10101)
This commit is contained in:
parent
d7bf7dc412
commit
d4380339c1
@ -4,43 +4,30 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# EDEN AI TOOLS"
|
"# Eden AI"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"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",
|
"\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",
|
"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",
|
||||||
"\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",
|
"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",
|
"\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",
|
||||||
"\n",
|
"\n",
|
||||||
"-text to speech\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",
|
|
||||||
"\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"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -52,42 +39,7 @@
|
|||||||
"\n",
|
"\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",
|
"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",
|
"\n",
|
||||||
"Once we have a key we'll want to set it as an environment variable by running:\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=\"...\")``"
|
||||||
"\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",
|
|
||||||
"]"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -140,7 +92,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## Exemple with text"
|
"## Example with text"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -182,13 +134,13 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"result=agent_chain(\"\"\" i have this text : 'i want to slap you' \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",
|
"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",
|
"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",
|
"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",
|
"if there is URL in the observations , you will always put it in the output (final answer) .\n",
|
||||||
"\n",
|
"\"\"\"\n",
|
||||||
" \"\"\")"
|
"result = agent_chain(input_)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -311,12 +263,13 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"result=agent_chain(\"\"\" i have this url of an image : \"https://static.javatpoint.com/images/objects.jpg\"\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",
|
"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",
|
"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",
|
"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",
|
"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": [
|
"source": [
|
||||||
"result=agent_chain(\"\"\" i have this url of an id: \"https://www.citizencard.com/images/citizencard-uk-id-card-2023.jpg\"\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",
|
"i want to extract the information in it.\n",
|
||||||
" create a text welcoming the person by his name and make it into speech \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",
|
"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": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": ".venv",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@ -541,9 +495,8 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.11"
|
"version": "3.11.3"
|
||||||
},
|
}
|
||||||
"orig_nbformat": 4
|
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 2
|
"nbformat_minor": 2
|
||||||
|
Loading…
Reference in New Issue
Block a user