Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.2.0
rev: 7.3.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 6.0.1
hooks:
- id: isort
args: [--profile=black]
103 changes: 103 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# CLAUDE.md

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perché ti ha duplicato creando un readme diverso?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questa è una roba interna di Claude code, lo genera così se lo rilegge ed ha del contesto sul progetto

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh ma che invadente che è, gli dobbiamo pure tenere i file


This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Askademic is a CLI tool that helps users find information in research papers from arXiv. It's built on PydanticAI and provides:
- Summarization of latest papers in categories
- Question answering by searching relevant papers
- Specific paper retrieval by title/link/arXiv ID

## Development Commands

### Installation & Setup
```bash
pip install . # Install the package
pip install -e . # Install in development mode
```

### Testing
```bash
pytest # Run all tests
pytest tests/test_article.py # Run specific test file
python evals/evals.py # Run evaluation tests
```

### Running the Application
```bash
askademic # Start the CLI application
```

### Code Quality
```bash
flake8 # Lint code (max line length: 99)
pre-commit run --all-files # Run pre-commit hooks
```

## Architecture

### Core Components

1. **main.py**: Entry point with CLI interface using prompt_toolkit and rich console
2. **orchestrator.py**: Main coordination agent that routes requests to specialized agents
3. **allower.py**: Determines if user queries are scientific (routes to orchestrator or returns puns)
4. **Specialized Agents**:
- **summary.py**: SummaryAgent for latest paper summaries
- **question.py**: QuestionAgent for Q&A with arXiv search
- **article.py**: ArticleAgent for specific paper retrieval and analysis
5. **memory.py**: Manages conversation context and token limits
6. **utils.py**: Model selection and arXiv API utilities
7. **tools.py**: Utility functions for arXiv interactions

### Agent Architecture
- Built on PydanticAI with structured Pydantic model outputs
- Uses orchestrator pattern - main orchestrator routes to specialized agents
- Each agent has specific tools and capabilities
- Memory management tracks conversation history with token limits

### Model Support
- **Gemini 2.0 Flash** (default, preferred for cost and context window)
- **Claude 3.5 Haiku** (experimental, rate limited)
- **Claude via AWS Bedrock** (experimental)
- **Nova Pro via AWS Bedrock** (experimental)

## Configuration

### Environment Variables
Required in `.env` file (copy from `.env-template`):
- `LLM_FAMILY`: "gemini", "claude", "claude-aws-bedrock", or "nova-pro-aws-bedrock"
- `GEMINI_API_KEY`: For Gemini models
- `ANTHROPIC_API_KEY`: For Claude models
- `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`: For AWS Bedrock

### Key Settings
- Max request tokens: 100,000 (configured in memory.py)
- Usage limits: 20 requests per agent run
- Default temperature: 0 for consistency
- Retry strategy: 20 retries with early termination

## Development Guidelines

### File Structure
- `src/askademic/`: Main package
- `prompts/`: System prompts in separate files
- `tests/`: Unit tests for each component
- `evals/`: Evaluation scripts
- `logs/`: Daily log files (auto-generated)

### Testing Strategy
- Unit tests for each agent and utility
- Manual evaluation suite in `evals/` directory
- CI/CD with GitHub Actions testing Python 3.11-3.13

### Agent Development
- Each agent follows PydanticAI patterns with structured outputs
- Tools decorated with `@agent.tool` for function calling
- Async/await throughout for API calls
- Comprehensive logging to daily log files

### Memory Management
- Conversation history maintained with token counting
- Automatic cleanup when limits exceeded
- Context window management for different models
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Askademic is an AI agent, working as a CLI tool, that helps you with finding inf
* summarise the latest papers in a category
* answer questions, searching first for relevant papers
* retrieve info about a specific paper, by link or title
* handle flexible academic requests that don't fit the standard categories

You can also ask follow-up questions. And, it has an eye for things non-scientific... see below.

Expand Down
4 changes: 4 additions & 0 deletions evals/evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dotenv import load_dotenv
from evals_allower import run_evals as run_evals_allower
from evals_article import run_evals as run_evals_article
from evals_general import run_evals as run_evals_general
from evals_orchestrator import run_evals as run_evals_orchestrator
from evals_question import run_evals as run_evals_question
from evals_summary import run_evals as run_evals_summary
Expand Down Expand Up @@ -67,6 +68,9 @@ async def main():
console.print("\n[bold magenta]Running article evals...[/bold magenta]")
await run_evals_article(model_family)

console.print("\n[bold magenta]Running general agent evals...[/bold magenta]")
await run_evals_general(model_family)


if __name__ == "__main__":
asyncio.run(main())
Loading