mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-27 09:45:16 +00:00
Add Korean translations (#3307)
This commit is contained in:
118
docs/ko/tools/ai-ml/aimindtool.mdx
Normal file
118
docs/ko/tools/ai-ml/aimindtool.mdx
Normal file
@@ -0,0 +1,118 @@
|
||||
---
|
||||
title: AI 마인드 툴
|
||||
description: AIMindTool은 자연어로 데이터 소스를 질의하도록 설계되었습니다.
|
||||
icon: brain
|
||||
---
|
||||
|
||||
# `AIMindTool`
|
||||
|
||||
## 설명
|
||||
|
||||
`AIMindTool`은 [MindsDB](https://mindsdb.com/)에서 제공하는 [AI-Minds](https://mindsdb.com/minds)의 래퍼입니다. 이 도구를 사용하면 연결 매개변수만 구성하여 자연어로 데이터 소스를 쿼리할 수 있습니다. 이 도구는 PostgreSQL, MySQL, MariaDB, ClickHouse, Snowflake, Google BigQuery 등 다양한 데이터 소스에 저장된 데이터에서 질문에 대한 답변이 필요할 때 유용합니다.
|
||||
|
||||
Mind는 LLM(Large Language Model)과 유사하게 작동하는 AI 시스템이지만, 그 이상으로 모든 데이터에서 모든 질문에 답변할 수 있습니다. 이는 다음과 같이 달성됩니다:
|
||||
- 파라메트릭 검색을 사용하여 답변에 가장 관련성 높은 데이터를 선택
|
||||
- 의미론적 검색을 통해 의미를 이해하고 올바른 맥락에서 응답 제공
|
||||
- 데이터를 분석하고 머신러닝(ML) 모델을 사용하여 정확한 답변 제공
|
||||
|
||||
## 설치
|
||||
|
||||
이 도구를 프로젝트에 통합하려면 Minds SDK를 설치해야 합니다:
|
||||
|
||||
```shell
|
||||
uv add minds-sdk
|
||||
```
|
||||
|
||||
## 시작 단계
|
||||
|
||||
`AIMindTool`을 효과적으로 사용하려면 다음 단계를 따르세요:
|
||||
|
||||
1. **패키지 설치**: Python 환경에 `crewai[tools]`와 `minds-sdk` 패키지가 설치되어 있는지 확인하세요.
|
||||
2. **API 키 획득**: Minds 계정에 [여기](https://mdb.ai/register)에서 가입하고 API 키를 받으세요.
|
||||
3. **환경 설정**: 획득한 API 키를 `MINDS_API_KEY`라는 환경 변수에 저장하여 툴이 사용할 수 있도록 하세요.
|
||||
|
||||
## 예시
|
||||
|
||||
다음 예시는 도구를 초기화하고 쿼리를 실행하는 방법을 보여줍니다:
|
||||
|
||||
```python Code
|
||||
from crewai_tools import AIMindTool
|
||||
|
||||
# Initialize the AIMindTool
|
||||
aimind_tool = AIMindTool(
|
||||
datasources=[
|
||||
{
|
||||
"description": "house sales data",
|
||||
"engine": "postgres",
|
||||
"connection_data": {
|
||||
"user": "demo_user",
|
||||
"password": "demo_password",
|
||||
"host": "samples.mindsdb.com",
|
||||
"port": 5432,
|
||||
"database": "demo",
|
||||
"schema": "demo_data"
|
||||
},
|
||||
"tables": ["house_sales"]
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
# Run a natural language query
|
||||
result = aimind_tool.run("How many 3 bedroom houses were sold in 2008?")
|
||||
print(result)
|
||||
```
|
||||
|
||||
## 매개변수
|
||||
|
||||
`AIMindTool`은 다음과 같은 매개변수를 허용합니다:
|
||||
|
||||
- **api_key**: 선택 사항입니다. 사용자의 Minds API 키입니다. 제공하지 않으면 `MINDS_API_KEY` 환경 변수에서 읽습니다.
|
||||
- **datasources**: 각 항목에 다음 키를 포함하는 사전들의 목록입니다:
|
||||
- **description**: 데이터 소스에 포함된 데이터에 대한 설명입니다.
|
||||
- **engine**: 데이터 소스의 엔진(또는 유형)입니다.
|
||||
- **connection_data**: 데이터 소스의 연결 매개변수를 포함하는 사전입니다.
|
||||
- **tables**: 데이터 소스에서 사용할 테이블 목록입니다. 이 항목은 선택 사항이며, 데이터 소스의 모든 테이블을 사용할 경우 생략할 수 있습니다.
|
||||
|
||||
지원되는 데이터 소스와 그 연결 매개변수 목록은 [여기](https://docs.mdb.ai/docs/data_sources)에서 확인할 수 있습니다.
|
||||
|
||||
## 에이전트 통합 예시
|
||||
|
||||
다음은 `AIMindTool`을 CrewAI 에이전트와 통합하는 방법입니다:
|
||||
|
||||
```python Code
|
||||
from crewai import Agent
|
||||
from crewai.project import agent
|
||||
from crewai_tools import AIMindTool
|
||||
|
||||
# Initialize the tool
|
||||
aimind_tool = AIMindTool(
|
||||
datasources=[
|
||||
{
|
||||
"description": "sales data",
|
||||
"engine": "postgres",
|
||||
"connection_data": {
|
||||
"user": "your_user",
|
||||
"password": "your_password",
|
||||
"host": "your_host",
|
||||
"port": 5432,
|
||||
"database": "your_db",
|
||||
"schema": "your_schema"
|
||||
},
|
||||
"tables": ["sales"]
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
# Define an agent with the AIMindTool
|
||||
@agent
|
||||
def data_analyst(self) -> Agent:
|
||||
return Agent(
|
||||
config=self.agents_config["data_analyst"],
|
||||
allow_delegation=False,
|
||||
tools=[aimind_tool]
|
||||
)
|
||||
```
|
||||
|
||||
## 결론
|
||||
|
||||
`AIMindTool`은 자연어를 사용하여 데이터 소스를 쿼리할 수 있는 강력한 방법을 제공하여 복잡한 SQL 쿼리를 작성하지 않고도 인사이트를 쉽게 추출할 수 있도록 해줍니다. 다양한 데이터 소스에 연결하고 AI-Minds 기술을 활용하여 이 도구는 agent들이 데이터를 효율적으로 접근하고 분석할 수 있게 해줍니다.
|
||||
208
docs/ko/tools/ai-ml/codeinterpretertool.mdx
Normal file
208
docs/ko/tools/ai-ml/codeinterpretertool.mdx
Normal file
@@ -0,0 +1,208 @@
|
||||
---
|
||||
title: 코드 인터프리터
|
||||
description: CodeInterpreterTool은(는) 안전하고 격리된 환경 내에서 Python 3 코드를 실행하도록 설계된 강력한 도구입니다.
|
||||
icon: code-simple
|
||||
---
|
||||
|
||||
# `CodeInterpreterTool`
|
||||
|
||||
## 설명
|
||||
|
||||
`CodeInterpreterTool`은 CrewAI 에이전트가 자율적으로 생성한 Python 3 코드를 실행할 수 있도록 합니다. 이 기능은 에이전트가 코드를 생성하고, 실행하며, 결과를 얻고, 그 정보를 활용하여 이후의 결정과 행동에 반영할 수 있다는 점에서 특히 유용합니다.
|
||||
|
||||
이 도구를 사용하는 방법에는 여러 가지가 있습니다:
|
||||
|
||||
### Docker 컨테이너(권장)
|
||||
|
||||
이것이 기본 옵션입니다. 코드는 안전하고 격리된 Docker 컨테이너에서 실행되어, 그 내용과 상관없이 안전성을 보장합니다.
|
||||
시스템에 Docker가 설치되어 실행 중인지 확인하세요. 설치되어 있지 않다면, [여기](https://docs.docker.com/get-docker/)에서 설치할 수 있습니다.
|
||||
|
||||
### 샌드박스 환경
|
||||
|
||||
Docker를 사용할 수 없을 경우—설치되어 있지 않거나 어떤 이유로든 접근할 수 없는 경우—코드는 샌드박스라고 불리는 제한된 Python 환경에서 실행됩니다.
|
||||
이 환경은 매우 제한적이며, 많은 모듈과 내장 함수들에 대해 엄격한 제한이 있습니다.
|
||||
|
||||
### 비안전 실행
|
||||
|
||||
**프로덕션 환경에서는 권장하지 않음**
|
||||
이 모드는 `sys, os..` 및 유사한 모듈에 대한 위험한 호출을 포함하여 모든 Python 코드를 실행할 수 있게 합니다. [비안전 모드 활성화 방법](/ko/tools/ai-ml/codeinterpretertool#enabling-unsafe-mode)를 확인하세요
|
||||
|
||||
## 로깅
|
||||
|
||||
`CodeInterpreterTool`은 선택된 실행 전략을 STDOUT에 기록합니다.
|
||||
|
||||
## 설치
|
||||
|
||||
이 도구를 사용하려면 CrewAI tools 패키지를 설치해야 합니다:
|
||||
|
||||
```shell
|
||||
pip install 'crewai[tools]'
|
||||
```
|
||||
|
||||
## 예시
|
||||
|
||||
다음 예시는 `CodeInterpreterTool`을 CrewAI agent와 함께 사용하는 방법을 보여줍니다:
|
||||
|
||||
```python Code
|
||||
from crewai import Agent, Task, Crew, Process
|
||||
from crewai_tools import CodeInterpreterTool
|
||||
|
||||
# Initialize the tool
|
||||
code_interpreter = CodeInterpreterTool()
|
||||
|
||||
# Define an agent that uses the tool
|
||||
programmer_agent = Agent(
|
||||
role="Python Programmer",
|
||||
goal="Write and execute Python code to solve problems",
|
||||
backstory="An expert Python programmer who can write efficient code to solve complex problems.",
|
||||
tools=[code_interpreter],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
# Example task to generate and execute code
|
||||
coding_task = Task(
|
||||
description="Write a Python function to calculate the Fibonacci sequence up to the 10th number and print the result.",
|
||||
expected_output="The Fibonacci sequence up to the 10th number.",
|
||||
agent=programmer_agent,
|
||||
)
|
||||
|
||||
# Create and run the crew
|
||||
crew = Crew(
|
||||
agents=[programmer_agent],
|
||||
tasks=[coding_task],
|
||||
verbose=True,
|
||||
process=Process.sequential,
|
||||
)
|
||||
result = crew.kickoff()
|
||||
```
|
||||
|
||||
agent를 생성할 때 코드 실행을 직접 활성화할 수도 있습니다:
|
||||
|
||||
```python Code
|
||||
from crewai import Agent
|
||||
|
||||
# Create an agent with code execution enabled
|
||||
programmer_agent = Agent(
|
||||
role="Python Programmer",
|
||||
goal="Write and execute Python code to solve problems",
|
||||
backstory="An expert Python programmer who can write efficient code to solve complex problems.",
|
||||
allow_code_execution=True, # This automatically adds the CodeInterpreterTool
|
||||
verbose=True,
|
||||
)
|
||||
```
|
||||
|
||||
### `unsafe_mode` 활성화
|
||||
|
||||
```python Code
|
||||
from crewai_tools import CodeInterpreterTool
|
||||
|
||||
code = """
|
||||
import os
|
||||
os.system("ls -la")
|
||||
"""
|
||||
|
||||
CodeInterpreterTool(unsafe_mode=True).run(code=code)
|
||||
```
|
||||
|
||||
## 파라미터
|
||||
|
||||
`CodeInterpreterTool`은(는) 초기화 시 다음과 같은 파라미터를 허용합니다:
|
||||
|
||||
- **user_dockerfile_path**: 선택 사항. 코드 인터프리터 컨테이너에서 사용할 커스텀 Dockerfile의 경로입니다.
|
||||
- **user_docker_base_url**: 선택 사항. 컨테이너 실행에 사용할 Docker 데몬의 URL입니다.
|
||||
- **unsafe_mode**: 선택 사항. Docker 컨테이너나 샌드박스 대신 코드가 호스트 머신에서 직접 실행될지 여부입니다. 기본값은 `False`입니다. 주의해서 사용하세요!
|
||||
- **default_image_tag**: 선택 사항. 기본 Docker 이미지 태그입니다. 기본값은 `code-interpreter:latest`입니다.
|
||||
|
||||
에이전트와 함께 이 도구를 사용할 때 에이전트는 다음을 제공해야 합니다:
|
||||
|
||||
- **code**: 필수. 실행할 Python 3 코드입니다.
|
||||
- **libraries_used**: 선택 사항. 코드에서 사용하여 설치가 필요한 라이브러리들의 목록입니다. 기본값은 `[]`입니다.
|
||||
|
||||
## 에이전트 통합 예제
|
||||
|
||||
여기 `CodeInterpreterTool`을 CrewAI 에이전트와 통합하는 방법에 대한 좀 더 자세한 예제가 있습니다:
|
||||
|
||||
```python Code
|
||||
from crewai import Agent, Task, Crew
|
||||
from crewai_tools import CodeInterpreterTool
|
||||
|
||||
# Initialize the tool
|
||||
code_interpreter = CodeInterpreterTool()
|
||||
|
||||
# Define an agent that uses the tool
|
||||
data_analyst = Agent(
|
||||
role="Data Analyst",
|
||||
goal="Analyze data using Python code",
|
||||
backstory="""You are an expert data analyst who specializes in using Python
|
||||
to analyze and visualize data. You can write efficient code to process
|
||||
large datasets and extract meaningful insights.""",
|
||||
tools=[code_interpreter],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
# Create a task for the agent
|
||||
analysis_task = Task(
|
||||
description="""
|
||||
Write Python code to:
|
||||
1. Generate a random dataset of 100 points with x and y coordinates
|
||||
2. Calculate the correlation coefficient between x and y
|
||||
3. Create a scatter plot of the data
|
||||
4. Print the correlation coefficient and save the plot as 'scatter.png'
|
||||
|
||||
Make sure to handle any necessary imports and print the results.
|
||||
""",
|
||||
expected_output="The correlation coefficient and confirmation that the scatter plot has been saved.",
|
||||
agent=data_analyst,
|
||||
)
|
||||
|
||||
# Run the task
|
||||
crew = Crew(
|
||||
agents=[data_analyst],
|
||||
tasks=[analysis_task],
|
||||
verbose=True,
|
||||
process=Process.sequential,
|
||||
)
|
||||
result = crew.kickoff()
|
||||
```
|
||||
|
||||
## 구현 세부사항
|
||||
|
||||
`CodeInterpreterTool`은 코드 실행을 위한 안전한 환경을 만들기 위해 Docker를 사용합니다:
|
||||
|
||||
```python Code
|
||||
class CodeInterpreterTool(BaseTool):
|
||||
name: str = "Code Interpreter"
|
||||
description: str = "Interprets Python3 code strings with a final print statement."
|
||||
args_schema: Type[BaseModel] = CodeInterpreterSchema
|
||||
default_image_tag: str = "code-interpreter:latest"
|
||||
|
||||
def _run(self, **kwargs) -> str:
|
||||
code = kwargs.get("code", self.code)
|
||||
libraries_used = kwargs.get("libraries_used", [])
|
||||
|
||||
if self.unsafe_mode:
|
||||
return self.run_code_unsafe(code, libraries_used)
|
||||
else:
|
||||
return self.run_code_safety(code, libraries_used)
|
||||
```
|
||||
|
||||
이 도구는 다음과 같은 단계를 수행합니다:
|
||||
1. Docker 이미지가 존재하는지 확인하거나 필요 시 이미지를 빌드합니다
|
||||
2. 현재 작업 디렉토리가 마운트된 Docker 컨테이너를 생성합니다
|
||||
3. 에이전트가 지정한 필요한 라이브러리를 설치합니다
|
||||
4. 컨테이너 내에서 Python 코드를 실행합니다
|
||||
5. 코드 실행 결과를 반환합니다
|
||||
6. 컨테이너를 중지하고 제거하여 정리합니다
|
||||
|
||||
## 보안 고려사항
|
||||
|
||||
기본적으로 `CodeInterpreterTool`은 코드를 격리된 Docker 컨테이너에서 실행하며, 이는 하나의 보안 계층을 제공합니다. 그러나 다음과 같은 보안 사항들을 염두에 두어야 합니다:
|
||||
|
||||
1. Docker 컨테이너는 현재 작업 디렉토리에 접근할 수 있으므로, 민감한 파일이 잠재적으로 접근될 수 있습니다.
|
||||
2. Docker 컨테이너를 사용할 수 없고 코드를 안전하게 실행해야 하는 경우, 샌드박스 환경에서 실행됩니다. 보안상의 이유로 임의의 라이브러리 설치는 허용되지 않습니다.
|
||||
3. `unsafe_mode` 매개변수를 사용하면 코드를 호스트 머신에서 직접 실행할 수 있으며, 이는 신뢰할 수 있는 환경에서만 사용해야 합니다.
|
||||
4. 에이전트가 임의의 라이브러리를 설치하도록 허용할 때는 주의해야 하며, 악성 코드가 포함될 가능성이 있습니다.
|
||||
|
||||
## 결론
|
||||
|
||||
`CodeInterpreterTool`은 CrewAI 에이전트가 비교적 안전한 환경에서 Python 코드를 실행할 수 있는 강력한 방법을 제공합니다. 에이전트가 코드를 작성하고 실행할 수 있도록 함으로써, 데이터 분석, 계산 또는 기타 계산 작업이 포함된 작업에서 특히 문제 해결 능력을 크게 확장합니다. 이 도구는 복잡한 연산을 자연어보다 코드로 표현하는 것이 더 효율적인 경우에 작업을 수행해야 하는 에이전트에게 특히 유용합니다.
|
||||
50
docs/ko/tools/ai-ml/dalletool.mdx
Normal file
50
docs/ko/tools/ai-ml/dalletool.mdx
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
title: DALL-E 도구
|
||||
description: DallETool은(는) 텍스트 설명으로부터 이미지를 생성할 수 있도록 설계된 강력한 도구입니다.
|
||||
icon: image
|
||||
---
|
||||
|
||||
# `DallETool`
|
||||
|
||||
## 설명
|
||||
|
||||
이 도구는 Agent가 DALL-E 모델을 사용하여 이미지를 생성할 수 있는 기능을 제공합니다. 이는 텍스트 설명으로부터 이미지를 생성하는 트랜스포머 기반 모델입니다.
|
||||
이 도구를 통해 사용자가 제공한 텍스트 입력을 바탕으로 Agent가 이미지를 생성할 수 있습니다.
|
||||
|
||||
## 설치
|
||||
|
||||
crewai_tools 패키지를 설치하세요
|
||||
```shell
|
||||
pip install 'crewai[tools]'
|
||||
```
|
||||
|
||||
## 예시
|
||||
|
||||
이 도구를 사용할 때는 텍스트가 반드시 Agent 자체에 의해 생성되어야 합니다. 텍스트는 생성하려는 이미지에 대한 설명이어야 합니다.
|
||||
|
||||
```python Code
|
||||
from crewai_tools import DallETool
|
||||
|
||||
Agent(
|
||||
...
|
||||
tools=[DallETool()],
|
||||
)
|
||||
```
|
||||
|
||||
필요하다면 `DallETool` 클래스에 인자를 전달하여 DALL-E 모델의 파라미터를 조정할 수도 있습니다. 예를 들면 다음과 같습니다:
|
||||
|
||||
```python Code
|
||||
from crewai_tools import DallETool
|
||||
|
||||
dalle_tool = DallETool(model="dall-e-3",
|
||||
size="1024x1024",
|
||||
quality="standard",
|
||||
n=1)
|
||||
|
||||
Agent(
|
||||
...
|
||||
tools=[dalle_tool]
|
||||
)
|
||||
```
|
||||
|
||||
파라미터는 OpenAI API의 `client.images.generate` 메서드를 기반으로 합니다. 파라미터에 대한 자세한 내용은 [OpenAI API 문서](https://platform.openai.com/docs/guides/images/introduction?lang=python)를 참고하세요.
|
||||
56
docs/ko/tools/ai-ml/langchaintool.mdx
Normal file
56
docs/ko/tools/ai-ml/langchaintool.mdx
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
title: LangChain 도구
|
||||
description: LangChainTool은 LangChain 도구 및 쿼리 엔진을 위한 래퍼(wrapper)입니다.
|
||||
icon: link
|
||||
---
|
||||
|
||||
## `LangChainTool`
|
||||
|
||||
<Info>
|
||||
CrewAI는 LangChain의 포괄적인 [도구 목록](https://python.langchain.com/docs/integrations/tools/)과 원활하게 통합되며, 이 모든 도구들은 CrewAI와 함께 사용할 수 있습니다.
|
||||
</Info>
|
||||
|
||||
```python Code
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from crewai import Agent, Task, Crew
|
||||
from crewai.tools import BaseTool
|
||||
from pydantic import Field
|
||||
from langchain_community.utilities import GoogleSerperAPIWrapper
|
||||
|
||||
# Set up your SERPER_API_KEY key in an .env file, eg:
|
||||
# SERPER_API_KEY=<your api key>
|
||||
load_dotenv()
|
||||
|
||||
search = GoogleSerperAPIWrapper()
|
||||
|
||||
class SearchTool(BaseTool):
|
||||
name: str = "Search"
|
||||
description: str = "Useful for search-based queries. Use this to find current information about markets, companies, and trends."
|
||||
search: GoogleSerperAPIWrapper = Field(default_factory=GoogleSerperAPIWrapper)
|
||||
|
||||
def _run(self, query: str) -> str:
|
||||
"""Execute the search query and return results"""
|
||||
try:
|
||||
return self.search.run(query)
|
||||
except Exception as e:
|
||||
return f"Error performing search: {str(e)}"
|
||||
|
||||
# Create Agents
|
||||
researcher = Agent(
|
||||
role='Research Analyst',
|
||||
goal='Gather current market data and trends',
|
||||
backstory="""You are an expert research analyst with years of experience in
|
||||
gathering market intelligence. You're known for your ability to find
|
||||
relevant and up-to-date market information and present it in a clear,
|
||||
actionable format.""",
|
||||
tools=[SearchTool()],
|
||||
verbose=True
|
||||
)
|
||||
|
||||
# rest of the code ...
|
||||
```
|
||||
|
||||
## 결론
|
||||
|
||||
도구는 CrewAI agent의 역량을 확장하는 데 핵심적인 역할을 하며, 다양한 작업을 수행하고 효과적으로 협업할 수 있도록 합니다. CrewAI로 솔루션을 구축할 때는 맞춤형 도구와 기존 도구를 모두 활용하여 agent를 강화하고 AI 생태계를 향상시키세요. 에러 처리, 캐싱 메커니즘, 그리고 도구 인자(argument)의 유연성 등을 활용하여 agent의 성능과 역량을 최적화하는 것을 고려해야 합니다.
|
||||
146
docs/ko/tools/ai-ml/llamaindextool.mdx
Normal file
146
docs/ko/tools/ai-ml/llamaindextool.mdx
Normal file
@@ -0,0 +1,146 @@
|
||||
---
|
||||
title: LlamaIndex 도구
|
||||
description: LlamaIndexTool은 LlamaIndex 도구와 쿼리 엔진의 래퍼입니다.
|
||||
icon: address-book
|
||||
---
|
||||
|
||||
# `LlamaIndexTool`
|
||||
|
||||
## 설명
|
||||
|
||||
`LlamaIndexTool`은 LlamaIndex 도구 및 쿼리 엔진에 대한 일반적인 래퍼로 설계되어, LlamaIndex 리소스를 RAG/agentic 파이프라인의 도구로 활용하여 CrewAI 에이전트에 연동할 수 있도록 합니다. 이 도구를 통해 LlamaIndex의 강력한 데이터 처리 및 검색 기능을 CrewAI 워크플로우에 원활하게 통합할 수 있습니다.
|
||||
|
||||
## 설치
|
||||
|
||||
이 도구를 사용하려면 LlamaIndex를 설치해야 합니다:
|
||||
|
||||
```shell
|
||||
uv add llama-index
|
||||
```
|
||||
|
||||
## 시작하는 단계
|
||||
|
||||
`LlamaIndexTool`을 효과적으로 사용하려면 다음 단계를 따르세요:
|
||||
|
||||
1. **LlamaIndex 설치**: 위의 명령어를 사용하여 LlamaIndex 패키지를 설치하세요.
|
||||
2. **LlamaIndex 설정**: [LlamaIndex 문서](https://docs.llamaindex.ai/)를 참고하여 RAG/에이전트 파이프라인을 설정하세요.
|
||||
3. **도구 또는 쿼리 엔진 생성**: CrewAI와 함께 사용할 LlamaIndex 도구 또는 쿼리 엔진을 생성하세요.
|
||||
|
||||
## 예시
|
||||
|
||||
다음 예시들은 다양한 LlamaIndex 컴포넌트에서 도구를 초기화하는 방법을 보여줍니다:
|
||||
|
||||
### LlamaIndex Tool에서
|
||||
|
||||
```python Code
|
||||
from crewai_tools import LlamaIndexTool
|
||||
from crewai import Agent
|
||||
from llama_index.core.tools import FunctionTool
|
||||
|
||||
# Example 1: Initialize from FunctionTool
|
||||
def search_data(query: str) -> str:
|
||||
"""Search for information in the data."""
|
||||
# Your implementation here
|
||||
return f"Results for: {query}"
|
||||
|
||||
# Create a LlamaIndex FunctionTool
|
||||
og_tool = FunctionTool.from_defaults(
|
||||
search_data,
|
||||
name="DataSearchTool",
|
||||
description="Search for information in the data"
|
||||
)
|
||||
|
||||
# Wrap it with LlamaIndexTool
|
||||
tool = LlamaIndexTool.from_tool(og_tool)
|
||||
|
||||
# Define an agent that uses the tool
|
||||
@agent
|
||||
def researcher(self) -> Agent:
|
||||
'''
|
||||
This agent uses the LlamaIndexTool to search for information.
|
||||
'''
|
||||
return Agent(
|
||||
config=self.agents_config["researcher"],
|
||||
tools=[tool]
|
||||
)
|
||||
```
|
||||
|
||||
### LlamaHub 도구에서
|
||||
|
||||
```python Code
|
||||
from crewai_tools import LlamaIndexTool
|
||||
from llama_index.tools.wolfram_alpha import WolframAlphaToolSpec
|
||||
|
||||
# Initialize from LlamaHub Tools
|
||||
wolfram_spec = WolframAlphaToolSpec(app_id="your_app_id")
|
||||
wolfram_tools = wolfram_spec.to_tool_list()
|
||||
tools = [LlamaIndexTool.from_tool(t) for t in wolfram_tools]
|
||||
```
|
||||
|
||||
### LlamaIndex 쿼리 엔진에서
|
||||
|
||||
```python Code
|
||||
from crewai_tools import LlamaIndexTool
|
||||
from llama_index.core import VectorStoreIndex
|
||||
from llama_index.core.readers import SimpleDirectoryReader
|
||||
|
||||
# Load documents
|
||||
documents = SimpleDirectoryReader("./data").load_data()
|
||||
|
||||
# Create an index
|
||||
index = VectorStoreIndex.from_documents(documents)
|
||||
|
||||
# Create a query engine
|
||||
query_engine = index.as_query_engine()
|
||||
|
||||
# Create a LlamaIndexTool from the query engine
|
||||
query_tool = LlamaIndexTool.from_query_engine(
|
||||
query_engine,
|
||||
name="Company Data Query Tool",
|
||||
description="Use this tool to lookup information in company documents"
|
||||
)
|
||||
```
|
||||
|
||||
## 클래스 메서드
|
||||
|
||||
`LlamaIndexTool`은 인스턴스를 생성하기 위한 두 가지 주요 클래스 메서드를 제공합니다:
|
||||
|
||||
### from_tool
|
||||
|
||||
LlamaIndex tool에서 `LlamaIndexTool`을 생성합니다.
|
||||
|
||||
```python Code
|
||||
@classmethod
|
||||
def from_tool(cls, tool: Any, **kwargs: Any) -> "LlamaIndexTool":
|
||||
# Implementation details
|
||||
```
|
||||
|
||||
### from_query_engine
|
||||
|
||||
LlamaIndex query engine에서 `LlamaIndexTool`을 생성합니다.
|
||||
|
||||
```python Code
|
||||
@classmethod
|
||||
def from_query_engine(
|
||||
cls,
|
||||
query_engine: Any,
|
||||
name: Optional[str] = None,
|
||||
description: Optional[str] = None,
|
||||
return_direct: bool = False,
|
||||
**kwargs: Any,
|
||||
) -> "LlamaIndexTool":
|
||||
# Implementation details
|
||||
```
|
||||
|
||||
## 파라미터
|
||||
|
||||
`from_query_engine` 메서드는 다음과 같은 파라미터를 받습니다:
|
||||
|
||||
- **query_engine**: 필수. 래핑할 LlamaIndex 쿼리 엔진입니다.
|
||||
- **name**: 선택 사항. 도구의 이름입니다.
|
||||
- **description**: 선택 사항. 도구의 설명입니다.
|
||||
- **return_direct**: 선택 사항. 응답을 직접 반환할지 여부입니다. 기본값은 `False`입니다.
|
||||
|
||||
## 결론
|
||||
|
||||
`LlamaIndexTool`은 LlamaIndex의 기능을 CrewAI 에이전트에 통합할 수 있는 강력한 방법을 제공합니다. LlamaIndex 도구와 쿼리 엔진을 래핑함으로써, 에이전트가 정교한 데이터 검색 및 처리 기능을 활용할 수 있게 하여, 복잡한 정보 소스를 다루는 능력을 강화합니다.
|
||||
63
docs/ko/tools/ai-ml/overview.mdx
Normal file
63
docs/ko/tools/ai-ml/overview.mdx
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
title: "개요"
|
||||
description: "AI 서비스를 활용하고, 이미지를 생성하며, 비전 처리를 수행하고, 지능형 시스템을 구축합니다"
|
||||
icon: "face-smile"
|
||||
---
|
||||
|
||||
이러한 도구들은 AI 및 머신러닝 서비스와 통합되어 이미지 생성, 비전 처리, 지능형 코드 실행과 같은 고급 기능으로 에이전트를 강화합니다.
|
||||
|
||||
## **사용 가능한 도구**
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="DALL-E 도구" icon="image" href="/ko/tools/ai-ml/dalletool">
|
||||
OpenAI의 DALL-E 모델을 사용하여 AI 이미지를 생성합니다.
|
||||
</Card>
|
||||
|
||||
<Card title="Vision 도구" icon="eye" href="/ko/tools/ai-ml/visiontool">
|
||||
컴퓨터 비전 기능으로 이미지를 처리하고 분석합니다.
|
||||
</Card>
|
||||
|
||||
<Card title="AI Mind 도구" icon="brain" href="/ko/tools/ai-ml/aimindtool">
|
||||
고급 AI 추론 및 의사결정 기능을 제공합니다.
|
||||
</Card>
|
||||
|
||||
<Card title="LlamaIndex 도구" icon="llama" href="/ko/tools/ai-ml/llamaindextool">
|
||||
LlamaIndex로 지식 베이스 및 검색 시스템을 구축합니다.
|
||||
</Card>
|
||||
|
||||
<Card title="LangChain 도구" icon="link" href="/ko/tools/ai-ml/langchaintool">
|
||||
LangChain과 통합하여 복잡한 AI 워크플로우를 구현합니다.
|
||||
</Card>
|
||||
|
||||
<Card title="RAG 도구" icon="database" href="/ko/tools/ai-ml/ragtool">
|
||||
Retrieval-Augmented Generation 시스템을 구현합니다.
|
||||
</Card>
|
||||
|
||||
<Card title="Code Interpreter 도구" icon="code" href="/ko/tools/ai-ml/codeinterpretertool">
|
||||
Python 코드를 실행하고 데이터 분석을 수행합니다.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## **일반적인 사용 사례**
|
||||
|
||||
- **콘텐츠 생성**: 이미지, 텍스트, 멀티미디어 콘텐츠 생성
|
||||
- **데이터 분석**: 코드 실행 및 복잡한 데이터셋 분석
|
||||
- **지식 시스템**: RAG 시스템 및 지능형 데이터베이스 구축
|
||||
- **컴퓨터 비전**: 시각적 콘텐츠 처리 및 이해
|
||||
- **AI 안전성**: 콘텐츠 모더레이션 및 안전성 점검 구현
|
||||
|
||||
```python
|
||||
from crewai_tools import DallETool, VisionTool, CodeInterpreterTool
|
||||
|
||||
# Create AI tools
|
||||
image_generator = DallETool()
|
||||
vision_processor = VisionTool()
|
||||
code_executor = CodeInterpreterTool()
|
||||
|
||||
# Add to your agent
|
||||
agent = Agent(
|
||||
role="AI Specialist",
|
||||
tools=[image_generator, vision_processor, code_executor],
|
||||
goal="Create and analyze content using AI capabilities"
|
||||
)
|
||||
```
|
||||
172
docs/ko/tools/ai-ml/ragtool.mdx
Normal file
172
docs/ko/tools/ai-ml/ragtool.mdx
Normal file
@@ -0,0 +1,172 @@
|
||||
---
|
||||
title: RAG 도구
|
||||
description: RagTool은 Retrieval-Augmented Generation을 사용하여 질문에 답변하는 동적 지식 기반 도구입니다.
|
||||
icon: vector-square
|
||||
---
|
||||
|
||||
# `RagTool`
|
||||
|
||||
## 설명
|
||||
|
||||
`RagTool`은 EmbedChain을 통한 RAG(Retrieval-Augmented Generation)의 강력함을 활용하여 질문에 답하도록 설계되었습니다.
|
||||
이는 다양한 데이터 소스에서 관련 정보를 검색할 수 있는 동적 지식 기반을 제공합니다.
|
||||
이 도구는 방대한 정보에 접근해야 하고 맥락에 맞는 답변을 제공해야 하는 애플리케이션에 특히 유용합니다.
|
||||
|
||||
## 예시
|
||||
|
||||
다음 예시는 도구를 초기화하고 다양한 데이터 소스와 함께 사용하는 방법을 보여줍니다:
|
||||
|
||||
```python Code
|
||||
from crewai_tools import RagTool
|
||||
|
||||
# Create a RAG tool with default settings
|
||||
rag_tool = RagTool()
|
||||
|
||||
# Add content from a file
|
||||
rag_tool.add(data_type="file", path="path/to/your/document.pdf")
|
||||
|
||||
# Add content from a web page
|
||||
rag_tool.add(data_type="web_page", url="https://example.com")
|
||||
|
||||
# Define an agent with the RagTool
|
||||
@agent
|
||||
def knowledge_expert(self) -> Agent:
|
||||
'''
|
||||
This agent uses the RagTool to answer questions about the knowledge base.
|
||||
'''
|
||||
return Agent(
|
||||
config=self.agents_config["knowledge_expert"],
|
||||
allow_delegation=False,
|
||||
tools=[rag_tool]
|
||||
)
|
||||
```
|
||||
|
||||
## 지원되는 데이터 소스
|
||||
|
||||
`RagTool`은 다양한 데이터 소스와 함께 사용할 수 있습니다. 예를 들어:
|
||||
|
||||
- 📰 PDF 파일
|
||||
- 📊 CSV 파일
|
||||
- 📃 JSON 파일
|
||||
- 📝 텍스트
|
||||
- 📁 디렉터리/폴더
|
||||
- 🌐 HTML 웹 페이지
|
||||
- 📽️ YouTube 채널
|
||||
- 📺 YouTube 동영상
|
||||
- 📚 문서화 웹사이트
|
||||
- 📝 MDX 파일
|
||||
- 📄 DOCX 파일
|
||||
- 🧾 XML 파일
|
||||
- 📬 Gmail
|
||||
- 📝 GitHub 저장소
|
||||
- 🐘 PostgreSQL 데이터베이스
|
||||
- 🐬 MySQL 데이터베이스
|
||||
- 🤖 Slack 대화
|
||||
- 💬 Discord 메시지
|
||||
- 🗨️ Discourse 포럼
|
||||
- 📝 Substack 뉴스레터
|
||||
- 🐝 Beehiiv 콘텐츠
|
||||
- 💾 Dropbox 파일
|
||||
- 🖼️ 이미지
|
||||
- ⚙️ 사용자 정의 데이터 소스
|
||||
|
||||
## 매개변수
|
||||
|
||||
`RagTool`은 다음과 같은 매개변수를 허용합니다:
|
||||
|
||||
- **summarize**: 선택 사항. 검색된 콘텐츠를 요약할지 여부입니다. 기본값은 `False`입니다.
|
||||
- **adapter**: 선택 사항. 지식 베이스에 대한 사용자 지정 어댑터입니다. 제공되지 않은 경우 EmbedchainAdapter가 사용됩니다.
|
||||
- **config**: 선택 사항. 내부 EmbedChain App의 구성입니다.
|
||||
|
||||
## 콘텐츠 추가
|
||||
|
||||
`add` 메서드를 사용하여 지식 베이스에 콘텐츠를 추가할 수 있습니다:
|
||||
|
||||
```python Code
|
||||
# PDF 파일 추가
|
||||
rag_tool.add(data_type="file", path="path/to/your/document.pdf")
|
||||
|
||||
# 웹 페이지 추가
|
||||
rag_tool.add(data_type="web_page", url="https://example.com")
|
||||
|
||||
# YouTube 비디오 추가
|
||||
rag_tool.add(data_type="youtube_video", url="https://www.youtube.com/watch?v=VIDEO_ID")
|
||||
|
||||
# 파일이 있는 디렉터리 추가
|
||||
rag_tool.add(data_type="directory", path="path/to/your/directory")
|
||||
```
|
||||
|
||||
## 에이전트 통합 예시
|
||||
|
||||
아래는 `RagTool`을 CrewAI 에이전트와 통합하는 방법입니다:
|
||||
|
||||
```python Code
|
||||
from crewai import Agent
|
||||
from crewai.project import agent
|
||||
from crewai_tools import RagTool
|
||||
|
||||
# Initialize the tool and add content
|
||||
rag_tool = RagTool()
|
||||
rag_tool.add(data_type="web_page", url="https://docs.crewai.com")
|
||||
rag_tool.add(data_type="file", path="company_data.pdf")
|
||||
|
||||
# Define an agent with the RagTool
|
||||
@agent
|
||||
def knowledge_expert(self) -> Agent:
|
||||
return Agent(
|
||||
config=self.agents_config["knowledge_expert"],
|
||||
allow_delegation=False,
|
||||
tools=[rag_tool]
|
||||
)
|
||||
```
|
||||
|
||||
## 고급 구성
|
||||
|
||||
`RagTool`의 동작을 구성 사전을 제공하여 사용자 지정할 수 있습니다.
|
||||
|
||||
```python Code
|
||||
from crewai_tools import RagTool
|
||||
|
||||
# 사용자 지정 구성으로 RAG 도구 생성
|
||||
config = {
|
||||
"app": {
|
||||
"name": "custom_app",
|
||||
},
|
||||
"llm": {
|
||||
"provider": "openai",
|
||||
"config": {
|
||||
"model": "gpt-4",
|
||||
}
|
||||
},
|
||||
"embedding_model": {
|
||||
"provider": "openai",
|
||||
"config": {
|
||||
"model": "text-embedding-ada-002"
|
||||
}
|
||||
},
|
||||
"vectordb": {
|
||||
"provider": "elasticsearch",
|
||||
"config": {
|
||||
"collection_name": "my-collection",
|
||||
"cloud_id": "deployment-name:xxxx",
|
||||
"api_key": "your-key",
|
||||
"verify_certs": False
|
||||
}
|
||||
},
|
||||
"chunker": {
|
||||
"chunk_size": 400,
|
||||
"chunk_overlap": 100,
|
||||
"length_function": "len",
|
||||
"min_chunk_size": 0
|
||||
}
|
||||
}
|
||||
|
||||
rag_tool = RagTool(config=config, summarize=True)
|
||||
```
|
||||
|
||||
내부 RAG 도구는 Embedchain 어댑터를 사용하므로 Embedchain에서 지원하는 모든 구성 옵션을 전달할 수 있습니다.
|
||||
자세한 내용은 [Embedchain 문서](https://docs.embedchain.ai/components/introduction)를 참조하세요.
|
||||
.yaml 파일에서 제공되는 구성 옵션을 반드시 검토하시기 바랍니다.
|
||||
|
||||
## 결론
|
||||
`RagTool`은 다양한 데이터 소스에서 지식 베이스를 생성하고 질의할 수 있는 강력한 방법을 제공합니다. Retrieval-Augmented Generation을 활용하여, 에이전트가 관련 정보를 효율적으로 접근하고 검색할 수 있게 하여, 보다 정확하고 상황에 맞는 응답을 제공하는 능력을 향상시킵니다.
|
||||
49
docs/ko/tools/ai-ml/visiontool.mdx
Normal file
49
docs/ko/tools/ai-ml/visiontool.mdx
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
title: 비전 도구
|
||||
description: VisionTool은 이미지에서 텍스트를 추출하도록 설계되었습니다.
|
||||
icon: eye
|
||||
---
|
||||
|
||||
# `VisionTool`
|
||||
|
||||
## 설명
|
||||
|
||||
이 도구는 이미지에서 텍스트를 추출하는 데 사용됩니다. 에이전트에 전달되면 이미지에서 텍스트를 추출한 후 이를 사용하여 응답, 보고서 또는 기타 출력을 생성합니다.
|
||||
이미지의 URL 또는 경로(PATH)를 에이전트에 전달해야 합니다.
|
||||
|
||||
## 설치
|
||||
|
||||
crewai_tools 패키지를 설치하세요
|
||||
|
||||
```shell
|
||||
pip install 'crewai[tools]'
|
||||
```
|
||||
|
||||
## 사용법
|
||||
|
||||
VisionTool을 사용하려면 OpenAI API 키를 환경 변수 `OPENAI_API_KEY`에 설정해야 합니다.
|
||||
|
||||
```python Code
|
||||
from crewai_tools import VisionTool
|
||||
|
||||
vision_tool = VisionTool()
|
||||
|
||||
@agent
|
||||
def researcher(self) -> Agent:
|
||||
'''
|
||||
이 agent는 VisionTool을 사용하여 이미지에서 텍스트를 추출합니다.
|
||||
'''
|
||||
return Agent(
|
||||
config=self.agents_config["researcher"],
|
||||
allow_delegation=False,
|
||||
tools=[vision_tool]
|
||||
)
|
||||
```
|
||||
|
||||
## 인수
|
||||
|
||||
VisionTool은 다음과 같은 인수가 필요합니다:
|
||||
|
||||
| 인수 | 타입 | 설명 |
|
||||
| :------------------ | :------- | :-------------------------------------------------------------------------------- |
|
||||
| **image_path_url** | `string` | **필수**. 텍스트를 추출해야 하는 이미지 파일의 경로입니다. |
|
||||
Reference in New Issue
Block a user