mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-07 16:09:30 +00:00
* feat: adopt directory-based docs versioning with Edge channel Switch docs.crewai.com from navigation-only versioning (every version selector entry rendered the same docs/<lang>/* source files) to Mintlify's directory-based versioning so each version selector entry renders its own snapshot. Add an "Edge" channel under docs/edge/<lang>/* that always reflects main HEAD for unreleased work, eliminating pre-release leakage onto frozen release labels. External links to canonical /<lang>/* URLs are preserved via wildcard redirects that always land on the current default version. Layout: - docs/edge/<lang>/* rolling source (you edit here) - docs/edge/enterprise-api.*.yaml - docs/v<X.Y.Z>/<lang>/* frozen, immutable snapshots - docs/v<X.Y.Z>/enterprise-api.*.yaml - docs/images/ shared, append-only - docs/docs.json nav + redirects URLs follow the Mintlify-idiomatic shape: /edge/<lang>/<page> for Edge, /v<X.Y.Z>/<lang>/<page> for every frozen snapshot. The wildcard redirects /<lang>/:slug* -> /<default>/<lang>/:slug* keep stale links working, and every freeze rewrites them (plus all per-section/per-page redirects) so destinations always resolve to the current default without depending on a second redirect hop. Release flow integration (devtools release): - New module crewai_devtools.docs_versioning.freeze() materialises docs/v<X.Y.Z>/ from docs/edge/, rewrites openapi: refs inside the snapshot, inserts the version into every language block in docs.json, and refreshes all redirect destinations. - _update_docs_and_create_pr() in cli.py now calls that freeze during Phase 2 of devtools release. Edge changelogs are updated first (so the snapshot freeze picks them up), then the snapshot is staged alongside docs.json, branched as docs/freeze-v<X.Y.Z>, and the PR is titled [docs-freeze] docs: snapshot and changelog for v<X.Y.Z> — the title prefix the new CI guard reads. - The PR still gates tag, GitHub release, PyPI publish, and the enterprise release as before; no new PRs are added. - Pre-releases (1.X.YaN, 1.X.YbN, ...) skip the snapshot — they ride Edge — and the docs PR title omits the [docs-freeze] prefix. - docs_check (AI-generated docs scaffolding) writes to docs/edge/<lang>/* so newly-generated unreleased docs land in Edge and never accidentally touch a frozen snapshot. Migration scripts (one-shot): - scripts/docs/freeze_historical_versions.py reconstructs all 16 historical snapshots (v1.10.0 .. v1.14.7) from git tags via git archive | tar, rewriting openapi: MDX refs so each snapshot reads its own enterprise-api YAML rather than the live one. - scripts/docs/prefix_version_paths.py one-shot-migrates docs.json: rewrites every page path in 16 versioned blocks to point under docs/v<X.Y.Z>/, inserts a new Edge entry per language, tags v1.14.7 as Latest (default), prunes pages whose target file doesn't exist in the snapshot (e.g. docs/ar/ didn't exist before v1.12.0), and writes the wildcard + per-section redirects. - scripts/docs/freeze_current_edge.py is now a thin CLI wrapper around docs_versioning.freeze for manual one-off freezes (e.g. retroactively snapshotting a forgotten release). CI guards (.github/workflows/docs-snapshots.yml): - Frozen snapshots under docs/v[0-9]*/ are immutable; only PRs whose title contains [docs-freeze] (i.e. release-cut PRs generated by devtools release or the manual wrapper) may modify them. - Images under docs/images/ are append-only since snapshots share a single image directory. Deleting or renaming an image breaks every historical snapshot that still references it. Restored docs/images/crewai-otel-export.png from PR #3673; it was deleted in PR #4908 but v1.10.0 / v1.10.1 snapshots still reference it. Restoring instead of editing the snapshots preserves historical rendering fidelity and validates the new append-only rule retroactively. Tests: - lib/devtools/tests/test_docs_versioning.py covers the freeze: file copy, openapi rewrite, version insertion, default demotion, redirect upserts, per-section redirect rewriting, idempotency, and invalid inputs. Verified locally with mintlify broken-links: 0 broken links across the full site (Edge + 16 frozen versions, 4 locales). AGENTS.md (repo root) is the contributor guide for the new model; RELEASING.md is the release-cut runbook; README's Contribution section links to both. Co-authored-by: Cursor <cursoragent@cursor.com> * style: resolve linter issues --------- Co-authored-by: Cursor <cursoragent@cursor.com>
140 lines
5.3 KiB
Plaintext
140 lines
5.3 KiB
Plaintext
---
|
|
title: "Tavily 추출기 도구"
|
|
description: "Tavily API를 사용하여 웹 페이지에서 구조화된 콘텐츠를 추출합니다"
|
|
icon: square-poll-horizontal
|
|
mode: "wide"
|
|
---
|
|
|
|
`TavilyExtractorTool`은 CrewAI 에이전트가 Tavily API를 사용하여 웹 페이지에서 구조화된 콘텐츠를 추출할 수 있도록 합니다. 이 도구는 단일 URL 또는 URL 목록을 처리할 수 있으며, 추출 깊이를 제어하고 이미지를 포함하는 등의 옵션을 제공합니다.
|
|
|
|
## 설치
|
|
|
|
`TavilyExtractorTool`을 사용하려면 `tavily-python` 라이브러리를 설치해야 합니다:
|
|
|
|
```shell
|
|
uv add 'crewai[tools]' tavily-python
|
|
```
|
|
|
|
또한 Tavily API 키를 환경 변수로 설정해야 합니다:
|
|
|
|
```bash
|
|
export TAVILY_API_KEY='your-tavily-api-key'
|
|
```
|
|
|
|
## 예제 사용법
|
|
|
|
다음은 CrewAI agent 내에서 `TavilyExtractorTool`을 초기화하고 사용하는 방법입니다:
|
|
|
|
```python
|
|
import os
|
|
from crewai import Agent, Task, Crew
|
|
from crewai_tools import TavilyExtractorTool
|
|
|
|
# Ensure TAVILY_API_KEY is set in your environment
|
|
# os.environ["TAVILY_API_KEY"] = "YOUR_API_KEY"
|
|
|
|
# Initialize the tool
|
|
tavily_tool = TavilyExtractorTool()
|
|
|
|
# Create an agent that uses the tool
|
|
extractor_agent = Agent(
|
|
role='Web Content Extractor',
|
|
goal='Extract key information from specified web pages',
|
|
backstory='You are an expert at extracting relevant content from websites using the Tavily API.',
|
|
tools=[tavily_tool],
|
|
verbose=True
|
|
)
|
|
|
|
# Define a task for the agent
|
|
extract_task = Task(
|
|
description='Extract the main content from the URL https://example.com using basic extraction depth.',
|
|
expected_output='A JSON string containing the extracted content from the URL.',
|
|
agent=extractor_agent
|
|
)
|
|
|
|
# Create and run the crew
|
|
crew = Crew(
|
|
agents=[extractor_agent],
|
|
tasks=[extract_task],
|
|
verbose=2
|
|
)
|
|
|
|
result = crew.kickoff()
|
|
print(result)
|
|
```
|
|
|
|
## 구성 옵션
|
|
|
|
`TavilyExtractorTool`은 다음과 같은 인자를 받습니다:
|
|
|
|
- `urls` (Union[List[str], str]): **필수**. 데이터를 추출할 단일 URL 문자열 또는 URL 문자열의 리스트.
|
|
- `include_images` (Optional[bool]): 추출 결과에 이미지를 포함할지 여부. 기본값은 `False`입니다.
|
|
- `extract_depth` (Literal["basic", "advanced"]): 추출의 깊이. 더 빠르고 표면적인 추출에는 `"basic"`을, 더 포괄적인 추출에는 `"advanced"`를 사용합니다. 기본값은 `"basic"`입니다.
|
|
- `timeout` (int): 추출 요청이 완료될 때까지 대기하는 최대 시간(초)입니다. 기본값은 `60`입니다.
|
|
|
|
## 고급 사용법
|
|
|
|
### 여러 URL과 고급 추출 기능
|
|
|
|
```python
|
|
# Example with multiple URLs and advanced extraction
|
|
multi_extract_task = Task(
|
|
description='Extract content from https://example.com and https://anotherexample.org using advanced extraction.',
|
|
expected_output='A JSON string containing the extracted content from both URLs.',
|
|
agent=extractor_agent
|
|
)
|
|
|
|
# Configure the tool with custom parameters
|
|
custom_extractor = TavilyExtractorTool(
|
|
extract_depth='advanced',
|
|
include_images=True,
|
|
timeout=120
|
|
)
|
|
|
|
agent_with_custom_tool = Agent(
|
|
role="Advanced Content Extractor",
|
|
goal="Extract comprehensive content with images",
|
|
tools=[custom_extractor]
|
|
)
|
|
```
|
|
|
|
### 도구 매개변수
|
|
|
|
도구의 동작을 초기화 시 매개변수를 설정하여 사용자 정의할 수 있습니다:
|
|
|
|
```python
|
|
# 사용자 정의 설정으로 초기화
|
|
extractor_tool = TavilyExtractorTool(
|
|
extract_depth='advanced', # 보다 포괄적인 추출
|
|
include_images=True, # 이미지 결과 포함
|
|
timeout=90 # 사용자 정의 타임아웃
|
|
)
|
|
```
|
|
|
|
## 기능
|
|
|
|
- **단일 또는 여러 URL**: 하나의 URL에서 콘텐츠를 추출하거나 한 번의 요청으로 여러 URL을 처리할 수 있습니다
|
|
- **구성 가능한 깊이**: 기본(빠른) 및 고급(포괄적인) 추출 모드 중에서 선택할 수 있습니다
|
|
- **이미지 지원**: 원할 경우 추출 결과에 이미지를 포함할 수 있습니다
|
|
- **구조화된 출력**: 추출된 콘텐츠가 잘 포맷된 JSON으로 반환됩니다
|
|
- **오류 처리**: 네트워크 시간 초과 및 추출 오류에 대한 견고한 처리
|
|
|
|
## 응답 형식
|
|
|
|
도구는 제공된 URL에서 추출한 구조화된 데이터를 나타내는 JSON 문자열을 반환합니다. 정확한 구조는 페이지의 내용과 사용된 `extract_depth`에 따라 달라집니다.
|
|
|
|
일반적인 응답 요소는 다음과 같습니다:
|
|
- **Title**: 페이지 제목
|
|
- **Content**: 페이지의 주요 텍스트 내용
|
|
- **Images**: 이미지 URL 및 메타데이터 (`include_images=True`인 경우)
|
|
- **Metadata**: 저자, 설명 등 추가적인 페이지 정보
|
|
|
|
## 사용 사례
|
|
|
|
- **콘텐츠 분석**: 경쟁사 웹사이트에서 콘텐츠를 추출하고 분석
|
|
- **연구**: 다양한 소스에서 구조화된 데이터를 수집하여 분석
|
|
- **콘텐츠 마이그레이션**: 기존 웹사이트에서 콘텐츠를 추출하여 마이그레이션
|
|
- **모니터링**: 변경 감지를 위해 정기적으로 콘텐츠 추출
|
|
- **데이터 수집**: 웹 소스에서 정보를 체계적으로 추출
|
|
|
|
응답 구조와 사용 가능한 옵션에 대한 자세한 정보는 [Tavily API 문서](https://docs.tavily.com/docs/tavily-api/python-sdk#extract)를 참고하세요. |