diff --git a/docs/docs/integrations/providers/taiga.mdx b/docs/docs/integrations/providers/taiga.mdx new file mode 100644 index 00000000000..5d7c9876110 --- /dev/null +++ b/docs/docs/integrations/providers/taiga.mdx @@ -0,0 +1,49 @@ +# Taiga + +> [Taiga](https://docs.taiga.io/) is an open-source project management platform designed for agile teams, offering features like Kanban, Scrum, and issue tracking. + +## Installation and Setup + +Install the `langchain-taiga` package: + +```bash +pip install langchain-taiga +``` + +You must provide a logins via environment variable so the tools can authenticate. + +```bash +export TAIGA_URL="https://taiga.xyz.org/" +export TAIGA_API_URL="https://taiga.xyz.org/" +export TAIGA_USERNAME="username" +export TAIGA_PASSWORD="pw" +export OPENAI_API_KEY="OPENAI_API_KEY" +``` + + +--- + +## Tools + +See a [usage example](/docs/integrations/tools/taiga) + +--- + +## Toolkit + +`TaigaToolkit` groups multiple Taiga-related tools into a single interface. + +```python +from langchain_taiga.toolkits import TaigaToolkit + +toolkit = TaigaToolkit() +tools = toolkit.get_tools() + +``` + +--- + +## Future Integrations + + +Check the [Taiga Developer Docs](https://docs.taiga.io/) for more information, and watch for updates or advanced usage examples in the [langchain_taiga GitHub repo](https://github.com/Shikenso-Analytics/langchain-taiga). \ No newline at end of file diff --git a/docs/docs/integrations/tools/taiga.ipynb b/docs/docs/integrations/tools/taiga.ipynb new file mode 100644 index 00000000000..9967d189617 --- /dev/null +++ b/docs/docs/integrations/tools/taiga.ipynb @@ -0,0 +1,306 @@ +{ + "cells": [ + { + "cell_type": "raw", + "id": "10238e62-3465-4973-9279-606cbb7ccf16", + "metadata": {}, + "source": [ + "---\n", + "sidebar_label: Taiga\n", + "---" + ] + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "# Taiga\n", + "\n", + "This notebook provides a quick overview for getting started with Taiga tooling in [langchain_taiga](https://github.com/Shikenso-Analytics/langchain-taiga/blob/main/docs/tools.ipynb). For more details on each tool and configuration, see the docstrings in your repository or relevant doc pages.\n", + "\n", + "\n", + "\n", + "## Overview\n", + "\n", + "### Integration details\n", + "\n", + "| Class | Package | Serializable | JS support | Package latest |\n", + "|:-----------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------| :---: |:------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------:|\n", + "| `create_entity_tool`, `search_entities_tool`, `get_entity_by_ref_tool`, `update_entity_by_ref_tool` , `add_comment_by_ref_tool`, `add_attachment_by_ref_tool` | [langchain-taiga](https://github.com/Shikenso-Analytics/langchain-taiga) | N/A | TBD | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-taiga?style=flat-square&label=%20) |\n", + "\n", + "### Tool features\n", + "\n", + "- **`create_entity_tool`**: Creates user stories, tasks and issues in Taiga.\n", + "- **`search_entities_tool`**: Searches for user stories, tasks and issues in Taiga.\n", + "- **`get_entity_by_ref_tool`**: Gets a user story, task or issue by reference.\n", + "- **`update_entity_by_ref_tool`**: Updates a user story, task or issue by reference.\n", + "- **`add_comment_by_ref_tool`**: Adds a comment to a user story, task or issue.\n", + "- **`add_attachment_by_ref_tool`**: Adds an attachment to a user story, task or issue.\n", + "\n", + "## Setup\n", + "\n", + "The integration lives in the `langchain-taiga` package." + ], + "id": "41616bfd02d989a6" + }, + { + "cell_type": "code", + "id": "f85b4089", + "metadata": { + "ExecuteTime": { + "end_time": "2025-02-28T12:43:23.290414Z", + "start_time": "2025-02-28T12:43:23.162563Z" + } + }, + "source": "%pip install --quiet -U langchain-taiga", + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/home/henlein/Workspace/PyCharm/langchain/.venv/bin/python: No module named pip\r\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], + "execution_count": 3 + }, + { + "cell_type": "markdown", + "id": "b15e9266", + "metadata": {}, + "source": [ + "### Credentials\n", + "\n", + "This integration requires you to set `TAIGA_URL`, `TAIGA_API_URL`, `TAIGA_USERNAME`, `TAIGA_PASSWORD` and `OPENAI_API_KEY` as environment variables to authenticate with Taiga.\n", + "\n", + "```bash\n", + "export TAIGA_URL=\"https://taiga.xyz.org/\"\n", + "export TAIGA_API_URL=\"https://taiga.xyz.org/\"\n", + "export TAIGA_USERNAME=\"username\"\n", + "export TAIGA_PASSWORD=\"pw\"\n", + "export OPENAI_API_KEY=\"OPENAI_API_KEY\"\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "bc5ab717-fd27-4c59-b912-bdd099541478", + "metadata": {}, + "source": [ + "It's also helpful (but not needed) to set up [LangSmith](https://smith.langchain.com/) for best-in-class observability:" + ] + }, + { + "cell_type": "code", + "id": "a6c2f136-6367-4f1f-825d-ae741e1bf281", + "metadata": { + "ExecuteTime": { + "end_time": "2025-02-28T12:43:23.295879Z", + "start_time": "2025-02-28T12:43:23.293809Z" + } + }, + "source": [ + "# os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n", + "# os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass()" + ], + "outputs": [], + "execution_count": 4 + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "## Instantiation\n", + "\n", + "Below is an example showing how to instantiate the Taiga tools in `langchain_taiga`. Adjust as needed for your specific usage." + ], + "id": "d6eab61edeeb40a5" + }, + { + "metadata": {}, + "cell_type": "code", + "outputs": [], + "execution_count": null, + "source": [ + "from langchain_taiga.tools.discord_read_messages import create_entity_tool\n", + "from langchain_taiga.tools.discord_send_messages import search_entities_tool\n", + "\n", + "create_tool = create_entity_tool\n", + "search_tool = search_entities_tool" + ], + "id": "8ae97a3413cd040e" + }, + { + "cell_type": "markdown", + "id": "74147a1a", + "metadata": {}, + "source": [ + "## Invocation\n", + "\n", + "### Direct invocation with args\n", + "\n", + "Below is a simple example of calling the tool with keyword arguments in a dictionary." + ] + }, + { + "cell_type": "code", + "id": "65310a8b-eb0c-4d9e-a618-4f4abe2414fc", + "metadata": {}, + "source": [ + "from langchain_taiga.tools.taiga_tools import (\n", + " add_attachment_by_ref_tool,\n", + " add_comment_by_ref_tool,\n", + " create_entity_tool,\n", + " get_entity_by_ref_tool,\n", + " search_entities_tool,\n", + " update_entity_by_ref_tool,\n", + ")\n", + "\n", + "response = create_entity_tool.invoke(\n", + " {\n", + " \"project_slug\": \"slug\",\n", + " \"entity_type\": \"us\",\n", + " \"subject\": \"subject\",\n", + " \"status\": \"new\",\n", + " \"description\": \"desc\",\n", + " \"parent_ref\": 5,\n", + " \"assign_to\": \"user\",\n", + " \"due_date\": \"2022-01-01\",\n", + " \"tags\": [\"tag1\", \"tag2\"],\n", + " }\n", + ")\n", + "\n", + "response = search_entities_tool.invoke(\n", + " {\"project_slug\": \"slug\", \"query\": \"query\", \"entity_type\": \"task\"}\n", + ")\n", + "\n", + "response = get_entity_by_ref_tool.invoke(\n", + " {\"entity_type\": \"user_story\", \"project_id\": 1, \"ref\": \"1\"}\n", + ")\n", + "\n", + "response = update_entity_by_ref_tool.invoke(\n", + " {\"project_slug\": \"slug\", \"entity_ref\": 555, \"entity_type\": \"us\"}\n", + ")\n", + "\n", + "\n", + "response = add_comment_by_ref_tool.invoke(\n", + " {\"project_slug\": \"slug\", \"entity_ref\": 3, \"entity_type\": \"us\", \"comment\": \"new\"}\n", + ")\n", + "\n", + "response = add_attachment_by_ref_tool.invoke(\n", + " {\n", + " \"project_slug\": \"slug\",\n", + " \"entity_ref\": 3,\n", + " \"entity_type\": \"us\",\n", + " \"attachment_url\": \"url\",\n", + " \"content_type\": \"png\",\n", + " \"description\": \"desc\",\n", + " }\n", + ")" + ], + "outputs": [], + "execution_count": null + }, + { + "cell_type": "markdown", + "id": "d6e73897", + "metadata": {}, + "source": [ + "### Invocation with ToolCall\n", + "\n", + "If you have a model-generated `ToolCall`, pass it to `tool.invoke()` in the format shown below." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f90e33a7", + "metadata": {}, + "outputs": [], + "source": [ + "# This is usually generated by a model, but we'll create a tool call directly for demo purposes.\n", + "model_generated_tool_call = {\n", + " \"args\": {\"project_slug\": \"slug\", \"query\": \"query\", \"entity_type\": \"task\"},\n", + " \"id\": \"1\",\n", + " \"name\": search_entities_tool.name,\n", + " \"type\": \"tool_call\",\n", + "}\n", + "tool.invoke(model_generated_tool_call)" + ] + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "## Chaining\n", + "\n", + "Below is a more complete example showing how you might integrate the `create_entity_tool` and `search_entities_tool` tools in a chain or agent with an LLM. This example assumes you have a function (like `create_react_agent`) that sets up a LangChain-style agent capable of calling tools when appropriate.\n", + "\n", + "\n", + "```python\n", + "# Example: Using Taiga Tools in an Agent\n", + "\n", + "from langgraph.prebuilt import create_react_agent\n", + "from langchain_taiga.tools.taiga_tools import create_entity_tool, search_entities_tool\n", + "\n", + "# 1. Instantiate or configure your language model\n", + "# (Replace with your actual LLM, e.g., ChatOpenAI(temperature=0))\n", + "llm = ...\n", + "\n", + "# 2. Build an agent that has access to these tools\n", + "agent_executor = create_react_agent(llm, [create_entity_tool, search_entities_tool])\n", + "\n", + "# 4. Formulate a user query that may invoke one or both tools\n", + "example_query = \"Please create a new user story with the subject 'subject' in slug project: 'slug'\"\n", + "\n", + "# 5. Execute the agent in streaming mode (or however your code is structured)\n", + "events = agent_executor.stream(\n", + " {\"messages\": [(\"user\", example_query)]},\n", + " stream_mode=\"values\",\n", + ")\n", + "\n", + "# 6. Print out the model's responses (and any tool outputs) as they arrive\n", + "for event in events:\n", + " event[\"messages\"][-1].pretty_print()\n", + "```\n" + ], + "id": "8cafefef7c8bd43e" + }, + { + "metadata": {}, + "cell_type": "markdown", + "source": [ + "## API reference\n", + "\n", + "See the docstrings in:\n", + "- [taiga_tools.py](https://github.com/Shikenso-Analytics/langchain-taiga/blob/main/langchain_taiga/tools/taiga_tools.py)\n", + "- [toolkits.py](https://github.com/Shikenso-Analytics/langchain-taiga/blob/main/langchain_taiga/toolkits.py)\n", + "\n", + "for usage details, parameters, and advanced configurations." + ], + "id": "4ac8146c" + } + ], + "metadata": { + "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.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/libs/packages.yml b/libs/packages.yml index b39a0984260..651d87e9a7d 100644 --- a/libs/packages.yml +++ b/libs/packages.yml @@ -470,3 +470,7 @@ packages: repo: writer/langchain-writer downloads: 0 downloads_updated_at: '2025-02-24T13:19:19.816059+00:00' +- name: langchain-taiga + name_title: Taiga + path: . + repo: Shikenso-Analytics/langchain-taiga