Metadata-Version: 2.2
Name: cogito
Version: 0.2.5
Summary: Cogito is a Python module designed to streamline the creation and deployment of inference services. It provides tools and abstractions to wrap machine learning models and expose them as robust, production-ready APIs with minimal effort.
Author-email: freepik-company/tech-avengers <aivengers@freepik.com>
Project-URL: Homepage, https://github.com/freepik-company/fc-py-cogito
Project-URL: Issues, https://github.com/freepik-company/fc-py-cogito/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1.8
Requires-Dist: fastapi>=0.115.6
Requires-Dist: google-cloud-storage>=2.19.0
Requires-Dist: huggingface-hub
Requires-Dist: jinja2>=3.1.5
Requires-Dist: opentelemetry-exporter-prometheus>=0.50b0
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.50b0
Requires-Dist: opentelemetry-sdk>=1.29.0
Requires-Dist: prometheus-client>=0.21.1
Requires-Dist: pydantic<3.0.0,>=1.10.0
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: structlog>=25.1.0
Requires-Dist: tomli>=2.0.1
Requires-Dist: uvicorn>=0.34.0

# Freepik Company cogito

Cogito is a versatile Python module aimed at simplifying the development and deployment of inference services. 
It allows users to wrap machine learning models or any computational logic into APIs effortlessly. 
With cogito, you can focus on your core algorithmic functionality while the module takes care of the heavy lifting, 
including API structure, request handling, error management, and scalability.

Key features include:
- Ease of Use: Simplifies the process of converting your models into production-ready APIs with minimal boilerplate code.
- Customizable API: Provides flexibility to define endpoints, input/output formats, and pre- / post-processing logic.
- Scalability: Optimized to handle high-throughput scenarios with support for modern server frameworks.
- Extensibility: Easily integrates with third-party libraries, monitoring tools, or cloud services.
- Error Handling: Built-in mechanisms to catch and handle runtime issues gracefully.

## Development

### Build the local development environment

```sh
make build
```

## Installation

### Using pip
Then, you can install the package:
```sh
pip install cogito
```

## Run example application

```sh
cd examples
python app.py
```

## Usage Guide: Cogito CLI

The **Cogito CLI** provides several commands to initialize, scaffold, and run your inference-based projects. This guide explains the available commands and their options.

---

## CLI Reference

- [Commands](#commands)
  - [Initialize](#initialize)
  - [Scaffold](#scaffold)
  - [Run](#run)

---


### Initialize

Command: `init`

**Description:** Initialize the project configuration with default or custom settings.

#### Options:

- `-s, --scaffold`: Generate a scaffold prediction class during initialization.
- `-d, --default`: Initialize with default values without prompts.
- `-f, --force`: Force initialization even if a configuration file already exists.

#### Usage:

```bash
cogito-cli init [OPTIONS]
```

**Examples:**

1. Initialize with prompts:
   ```bash
   cogito-cli init
   ```

2. Initialize with default values:
   ```bash
   cogito-cli init --default
   ```

3. Initialize and scaffold prediction classes:
   ```bash
   cogito-cli init --scaffold
   ```

---

### Scaffold

Command: `scaffold`

**Description:** Generate prediction class files based on the routes defined in the configuration file (`cogito.yaml`).

#### Options:

- `-f, --force`: Overwrite existing files if they already exist.

#### Usage:

```bash
cogito-cli scaffold [OPTIONS]
```

**Examples:**

1. Scaffold prediction classes:
   ```bash
   cogito-cli scaffold
   ```

2. Scaffold and overwrite existing files:
   ```bash
   cogito-cli scaffold --force
   ```

---

### Run

Command: `run`

**Description:** Run the cogito application based on the configuration in the specified directory.

#### Usage:

```bash
cogito-cli [-c context] run
```

**Example:**

1. Run the cogito application located in `examples` directory:
   ```bash
   cogito-cli -c examples run
   ```

This will:
- Change the current working directory to the configuration path.
- Load the application based on the `cogito.yaml` file.
- Start the FastAPI server for your inference service.

---
