Skip to content

A command-line tool that answers questions by searching the web, analyzing content, and generating comprehensive answers with sources.

License

Notifications You must be signed in to change notification settings

dimdasci/askweb

Repository files navigation

AskWeb

A command-line tool that answers questions by searching the web, analyzing content, and generating comprehensive answers with sources.

Features

  • Optimizes search queries using GPT-4
  • Searches the web using DuckDuckGo
  • Extracts clean content from web pages
  • Analyzes content relevance using AI
  • Generates detailed answers with sources
  • Provides a summarized response

Installation

  1. Clone the repository:
git clone <repository-url>
cd askweb
  1. Install the package:
pip install .

Configuration

Set your OpenAI API key as an environment variable:

export OPENAI_API_KEY="your-api-key"

Usage

Basic usage:

askweb "Your question here"

With custom number of search results per query:

askweb --max-results 10 "Your question here"

Project Structure

askweb/
├── pyproject.toml          # Project configuration and dependencies
├── .pre-commit-config.yaml # Pre-commit hooks configuration
├── src/
│   └── askweb/
│       ├── __init__.py
│       ├── cli.py           # Command-line interface
│       ├── models.py        # Pydantic data models
│       ├── search.py        # Web search functionality
│       ├── content.py       # Content extraction
│       ├── analysis.py      # Content analysis
│       ├── openai_client.py # OpenAI API integration
│       └── prompts.py       # Prompt templates
└── tests/
    └── __init__.py

Dependencies

License

MIT License - see LICENSE file for details.

Development

To set up the development environment:

  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
  1. Install development dependencies:
pip install -e ".[dev]"
  1. Run tests:
pytest
  1. Code formatting and linting:
# Format code
ruff format .
# Run isort
ruff check --select I --fix .

# Run linter
ruff check .

# Run linter with auto-fix
ruff check --fix .

Code Style

This project uses Ruff for both code formatting and linting. The configuration follows these principles:

  • Line length: 88 characters (same as Black)
  • Python 3.12 target version
  • Google-style docstrings
  • Strict linting rules with select exceptions
  • Automatic code formatting

To ensure your code meets the project standards:

  1. Format your code: ruff format .
  2. Fix linting issues: ruff check --fix .
  3. Address any remaining linting issues: ruff check .

About

A command-line tool that answers questions by searching the web, analyzing content, and generating comprehensive answers with sources.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published