Spaces:
Sleeping
Sleeping
File size: 1,909 Bytes
9cef3a3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | """VELA Framework - ๊ฐ๋จํ ์ฌ์ฉ ์์
ํ๊ฒฝ ์ค์ ํ ์คํ:
cp .env.example .env
# .env์ API ํค ์ค์
python examples/simple_analysis.py
"""
from dotenv import load_dotenv
load_dotenv()
from vela import ResearchAgent
from vela.schemas import ResearchOptions
def main():
# 1. ์์ด์ ํธ ์ด๊ธฐํ (MLX ๋ฐฑ์๋ ์ฌ์ฉ)
agent = ResearchAgent(llm_backend="mlx")
# 2. ๋ฆฌ์์น ์ต์
์ค์
options = ResearchOptions(
max_iterations=3, # ๋น ๋ฅธ ๋ฐ๋ชจ๋ฅผ ์ํด 3ํ
extract_content=True, # ์นํ์ด์ง ๋ณธ๋ฌธ ์ถ์ถ
enable_verification=False, # ๊ฒ์ฆ ๋นํ์ฑํ (Perplexity ํค ๋ถํ์)
)
# 3. ๋ฆฌ์์น ์คํ
result = agent.research(
query="SKํ์ด๋์ค HBM ์์ฅ ์ ๋ง",
options=options,
)
# 4. ๊ฒฐ๊ณผ ํ์ธ
print(f"=== ๋ฆฌ์์น ๊ฒฐ๊ณผ ===")
print(f"์ฟผ๋ฆฌ: {result.query}")
print(f"์ ๋ขฐ๋: {result.confidence:.0%}")
print(f"์์ค ์: {len(result.sources)}๊ฐ")
print(f"์์ ์๊ฐ: {result.metadata.elapsed_seconds:.1f}์ด")
print()
# ํต์ฌ ๋ฐ๊ฒฌ
print("=== ํต์ฌ ๋ฐ๊ฒฌ ===")
for i, finding in enumerate(result.key_findings or [], 1):
print(f" {i}. {finding}")
print()
# ๊ฒฐ๋ก (์๋ถ๋ถ)
print("=== ๊ฒฐ๋ก (์์ฝ) ===")
if result.conclusion:
print(result.conclusion[:500])
print()
# ์์ค ๋ชฉ๋ก
print("=== ์์ค ===")
for src in result.sources[:5]:
print(f" [{src.source_type}] {src.title[:60]}")
# 5. JSON์ผ๋ก ์ ์ฅ (์ ํ)
from pathlib import Path
output_dir = Path("output")
output_dir.mkdir(exist_ok=True)
saved = ResearchAgent.save_with_metadata(
result=result,
output_path=output_dir / "example_result.json",
)
print(f"\n์ ์ฅ ์๋ฃ: {saved['result']}")
if __name__ == "__main__":
main()
|