Skip to content

Latest commit

 

History

History
112 lines (80 loc) · 2.39 KB

File metadata and controls

112 lines (80 loc) · 2.39 KB

Medea Examples

Quick examples to get you started.

Setup

# Install
pip install -e .

# Configure (.env file)
MEDEADB_PATH=/path/to/MedeaDB
BACKBONE_LLM=gpt-4o
OPENROUTER_API_KEY=your-key

Run Examples

Full system:

python examples/quickstart.py

Custom workflows:

python examples/custom_workflow.py

Quick Snippets

1. Full Medea System

from medea import medea, AgentLLM, LLMConfig
from medea import ResearchPlanning, Analysis, LiteratureReasoning

llm = AgentLLM(LLMConfig({"temperature": 0.4}), llm_name="gpt-4o")

result = medea(
    user_instruction="Which gene is best for RA?",
    research_planning_module=ResearchPlanning(llm),
    analysis_module=Analysis(llm),
    literature_module=LiteratureReasoning(llm)
)

print(result['final'])

2. Research Planning Only

from medea import ResearchPlanning, AgentLLM, LLMConfig
from agentlite.commons import TaskPackage

llm = AgentLLM(LLMConfig({"temperature": 0.4}), llm_name="gpt-4o")
agent = ResearchPlanning(llm)

task = TaskPackage(instruction=str({"user_query": "Your question"}))
result = agent(task)
print(result['proposal_draft'].proposal)

3. Experiment Only

from medea import experiment_analysis
from medea import ResearchPlanning, Analysis, AgentLLM, LLMConfig

llm = AgentLLM(LLMConfig({"temperature": 0.4}), llm_name="gpt-4o")

plan, result = experiment_analysis(
    query="Your question",
    research_planning_module=ResearchPlanning(llm),
    analysis_module=Analysis(llm)
)

Customization

Temperature:

LLMConfig({"temperature": 0.2})  # Focused
LLMConfig({"temperature": 0.7})  # Creative

Different models:

research_llm = AgentLLM(LLMConfig({"temperature": 0.3}), llm_name="gpt-4o")
analysis_llm = AgentLLM(LLMConfig({"temperature": 0.5}), llm_name="claude")

Max iterations:

from medea import IntegrityVerification, AnalysisQualityChecker

IntegrityVerification(max_iter=3)  # Research plan quality
AnalysisQualityChecker(max_iter=2)      # Code quality

Troubleshooting

Import error: pip install -e .

Missing MedeaDB: huggingface-cli download psui3905/MedeaDB --local-dir ./MedeaDB

API key: Check .env file exists with correct format

More Info