semvec/pypi-packages huggingface dataset:
pardusagnet 0.1.2
The simplest agent library you have ever seen
Requires Python: >=3.10

# PardusAgent

A Python client library for building AI agents with tool-calling capabilities powered by Pardus AI.

## Quick Start

To get API key visit http://pardusai.org/ ! 

### Installation

```bash
pip install pardusagnet
```

### Basic Usage

```python
import asyncio
from pardusagnet import Tool, Agent


def add(a: int, b: int) -> int:
    """Add two integers together"""
    return a + b


def minus(a: int, b: int) -> int:
    """Subtract b from a"""
    return a - b


async def main():
    agent = Agent(
        tools=[Tool(add), Tool(minus)],
        models="glm-4.5",
        PardusAPI="pk_your_api_key_here" # better export PARDUS_API_KEY="YOUR API KEY HERE"
    )
    
    result = await agent.run("Calculate 100 minus 42")
    
    print(result['text'])
    for tool_result in result['tool_results']:
        print(f"{tool_result['name']}: {tool_result['result']}")


asyncio.run(main())
```

### Configuration

- **API Key**: Set via `PardusAPI` parameter or `PARDUS_API_KEY` environment variable
- **Server URL**: Default is `pardusai.org`, customize with `base_url` parameter
- **Model**: Any model supported by Pardus AI (e.g., `minimax/minimax-m2:free`)

### Example

See the complete example in `examples/simple_agent.py`

```bash
python examples/simple_agent.py
```
asyncpg-vector 0.1.0
PostgreSQL vector support for asyncpg
Requires Python: >=3.10
Keywords: asyncpg, postgresql-extension, vector, vector-search

# PostgreSQL vector support for asyncpg

Adds PostgreSQL [vector](https://github.com/pgvector/pgvector) support for Python.

Registers data types `vector` and `halfvec` from the PostgreSQL extension `vector` to the asynchronous PostgreSQL client `asyncpg`, and marshals vector data to and from PostgreSQL database tables.

Internally, the data is packed into a Python `bytes` object, with single-precision float vectors stored on 4 bytes per item (for class `Vector`) and half-precision float vectors stored on 2 bytes per item (for class `HalfVector`). Data is (un)packed using `struct` from the standard library as necessary.

This module provides functionality similar to [pgvector-python](https://github.com/pgvector/pgvector-python) but imports minimum dependencies (e.g. no dependency on `numpy`).

## Setup

#### Install the package

```sh
pip install asyncpg_vector
```

#### Initialize

Register vector types with your database connection or connection pool:

**Connection**:

```python
from asyncpg_vector import register_vector

async def main() -> None:
    ...

    await conn.execute("CREATE EXTENSION IF NOT EXISTS vector")
    await register_vector(conn)
```

**Pool**:

```python
from asyncpg_vector import register_vector

async def init_connection(conn: asyncpg.Connection) -> None:
    await conn.execute("CREATE EXTENSION IF NOT EXISTS vector")
    await register_vector(conn)

async def main() -> None:
    ...

    pool = await asyncpg.create_pool(..., init=init_connection)
```

#### Perform similarity search

First, create a table and an index:

```python
async def create(conn: asyncpg.Connection) -> None:
    await conn.execute("""
        CREATE TABLE IF NOT EXISTS items
        (
            id bigint NOT NULL GENERATED ALWAYS AS IDENTITY,
            content text NOT NULL,
            embedding halfvec(1536) NOT NULL,
            CONSTRAINT pk_items PRIMARY KEY (id)
        );

        CREATE INDEX IF NOT EXISTS embedding_index ON items
        USING hnsw (embedding halfvec_cosine_ops);
    """)
```

Next, find documents in a knowledge base that match a search phrase using vector similarity with approximate nearest neighbor semantics:

```python
from asyncpg_vector import HalfVector

async def search(conn: asyncpg.Connection, phrase: str) -> list[str]:
    ...

    embedding_response = await ai_client.embeddings.create(
        input=phrase,
        model="text-embedding-3-small",
        encoding_format="base64"
    )
    embedding = HalfVector.from_float_base64(embedding_response.data[0].embedding)
    query = """
        SELECT
            id,
            content,
            embedding <=> $1 AS distance
        FROM items
        ORDER BY distance
        LIMIT 5
    """
    rows = await conn.fetch(query, embedding)

    ...
```