이 가이드는 langchain_taiga에서 Taiga 도구를 시작하기 위한 빠른 개요를 제공합니다. 각 도구 및 구성에 대한 자세한 내용은 저장소의 docstring 또는 관련 문서 페이지를 참조하세요.

Overview

Integration details

ClassPackageSerializableJS supportVersion
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_toollangchain-taigaN/ATBDPyPI - Version

Tool features

  • create_entity_tool: Taiga에서 user story, task 및 issue를 생성합니다.
  • search_entities_tool: Taiga에서 user story, task 및 issue를 검색합니다.
  • get_entity_by_ref_tool: reference로 user story, task 또는 issue를 가져옵니다.
  • update_entity_by_ref_tool: reference로 user story, task 또는 issue를 업데이트합니다.
  • add_comment_by_ref_tool: user story, task 또는 issue에 댓글을 추가합니다.
  • add_attachment_by_ref_tool: user story, task 또는 issue에 첨부 파일을 추가합니다.

Setup

이 integration은 langchain-taiga package에 포함되어 있습니다.
pip install --quiet -U langchain-taiga
/home/henlein/Workspace/PyCharm/langchain/.venv/bin/python: No module named pip
Note: you may need to restart the kernel to use updated packages.

Credentials

이 integration을 사용하려면 Taiga 인증을 위해 TAIGA_URL, TAIGA_API_URL, TAIGA_USERNAME, TAIGA_PASSWORDOPENAI_API_KEY를 환경 변수로 설정해야 합니다.
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"
최고 수준의 observability를 위해 LangSmith를 설정하는 것도 유용합니다(필수는 아님):
os.environ["LANGSMITH_TRACING"] = "true"
# os.environ["LANGSMITH_API_KEY"] = getpass.getpass()

Instantiation

아래는 langchain_taiga에서 Taiga 도구를 인스턴스화하는 방법을 보여주는 예제입니다. 특정 사용 사례에 맞게 조정하세요.
from langchain_taiga.tools.discord_read_messages import create_entity_tool
from langchain_taiga.tools.discord_send_messages import search_entities_tool

create_tool = create_entity_tool
search_tool = search_entities_tool

Invocation

Direct invocation with args

아래는 dictionary에 keyword argument를 사용하여 도구를 호출하는 간단한 예제입니다.
from langchain_taiga.tools.taiga_tools import (
    add_attachment_by_ref_tool,
    add_comment_by_ref_tool,
    create_entity_tool,
    get_entity_by_ref_tool,
    search_entities_tool,
    update_entity_by_ref_tool,
)

response = create_entity_tool.invoke(
    {
        "project_slug": "slug",
        "entity_type": "us",
        "subject": "subject",
        "status": "new",
        "description": "desc",
        "parent_ref": 5,
        "assign_to": "user",
        "due_date": "2022-01-01",
        "tags": ["tag1", "tag2"],
    }
)

response = search_entities_tool.invoke(
    {"project_slug": "slug", "query": "query", "entity_type": "task"}
)

response = get_entity_by_ref_tool.invoke(
    {"entity_type": "user_story", "project_id": 1, "ref": "1"}
)

response = update_entity_by_ref_tool.invoke(
    {"project_slug": "slug", "entity_ref": 555, "entity_type": "us"}
)


response = add_comment_by_ref_tool.invoke(
    {"project_slug": "slug", "entity_ref": 3, "entity_type": "us", "comment": "new"}
)

response = add_attachment_by_ref_tool.invoke(
    {
        "project_slug": "slug",
        "entity_ref": 3,
        "entity_type": "us",
        "attachment_url": "url",
        "content_type": "png",
        "description": "desc",
    }
)

Invocation with ToolCall

model이 생성한 ToolCall이 있는 경우, 아래 형식으로 tool.invoke()에 전달하세요.
# This is usually generated by a model, but we'll create a tool call directly for demo purposes.
model_generated_tool_call = {
    "args": {"project_slug": "slug", "query": "query", "entity_type": "task"},
    "id": "1",
    "name": search_entities_tool.name,
    "type": "tool_call",
}
tool.invoke(model_generated_tool_call)

Chaining

아래는 LLM과 함께 chain 또는 agent에서 create_entity_toolsearch_entities_tool 도구를 통합하는 방법을 보여주는 보다 완전한 예제입니다. 이 예제는 적절한 경우 도구를 호출할 수 있는 LangChain 스타일 agent를 설정하는 함수(예: create_agent)가 있다고 가정합니다.
# Example: Using Taiga Tools in an Agent

from langchain.agents import create_agent
from langchain_taiga.tools.taiga_tools import create_entity_tool, search_entities_tool


# 1. Instantiate or configure your language model
# (Replace with your actual LLM, e.g., ChatOpenAI(temperature=0))
model = ...

# 2. Build an agent that has access to these tools
agent_executor = create_agent(model, [create_entity_tool, search_entities_tool])

# 4. Formulate a user query that may invoke one or both tools
example_query = "Please create a new user story with the subject 'subject' in slug project: 'slug'"

# 5. Execute the agent in streaming mode (or however your code is structured)
events = agent_executor.stream(
    {"messages": [("user", example_query)]},
    stream_mode="values",
)

# 6. Print out the model's responses (and any tool outputs) as they arrive
for event in events:
    event["messages"][-1].pretty_print()

API reference

사용 세부 정보, parameter 및 고급 구성에 대해서는 다음의 docstring을 참조하세요:
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I