semvec/pypi-packages huggingface dataset:
dqrobotics 25.4.0a17
dqrobotics Python
Requires Python: >=3.9

# dqrobotics-python  [![Python package](https://github.com/dqrobotics/python/actions/workflows/python_package.yml/badge.svg)](https://github.com/dqrobotics/python/actions/workflows/python_package.yml) [![PyPI version](https://badge.fury.io/py/dqrobotics.svg)](https://badge.fury.io/py/dqrobotics) 
The DQ Robotics library in Python

Refer to the [docs](https://dqroboticsgithubio.readthedocs.io/en/latest/installation/python.html)


## Dev Stuff

With the initial settings described below for each system, the `actions_runner` will pick up the correct version of Python and run the CI accordingly. 

### Setting up the self-hosted CI environment for Apple Silicon

_From [363627c](https://github.com/dqrobotics/python/commit/363627cdbd3d9207cd22a9ad618f57af29f26bd0), a self-hosted machine for `arm64` MacOS is no longer needed. The Github-hosted image is currently `arm64` by default._

1. Install `brew`
2. Install the Python versions currently supported by DQRobotics e.g. 
```
brew install python@3.XX
```
3. Add an alias for each Python version in your `.zshrc`, e.g. `alias python3.XX='/opt/homebrew/bin/python3.XX'`


### Setting up the self-hosted CI environment for Ubuntu arm64

_From [1198a5b](https://github.com/dqrobotics/python/commit/1198a5bf703d0e5acbed426761804b642eb7dc9c), a self-hosted machine for Ubuntu `arm64` is no longer needed. Tags such as `ubuntu-22.04-arm` enable the `arm64` version of Ubuntu_

0. Make sure you have the basic compilation enviroment
```
sudo apt update && sudo apt upgrade -y
sudo apt install git g++ cmake
```

1. Add the deadsnakes PPA
```
sudo add-apt-repository ppa:deadsnakes/ppa
```
2. Run 
```
sudo apt update
```
3. Install, for each Python version, the following 
```
sudo apt install python3.XX-dev python3.XX-venv python3.XX-distutils
```
trim-sdk 0.2.2
Trim SDK.
Requires Python: >=3.10

# 🧠 Trim LangChain SDK

**Trim LangChain** is a lightweight, OpenAI-compatible SDK designed for smart routing and efficient interaction with LLMs. It integrates seamlessly with LangChain agents, chat models, and OpenAI-style APIs.

---

## 📦 Installation

Install the SDK via pip:

```bash
pip install trim-sdk
```

---

## 🚀 Quick Start

---

### 🔐 Environment Variables

To use the SDK, you need to set the following environment variables in a `.env` file or your system environment:

```env
TRIM_API_KEY=your_trim_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
```

- **`TRIM_API_KEY`**: Your API key for authenticating with the Trim backend.
- **`OPENAI_API_KEY`**: Your OpenAI API key used internally by Trim to route to OpenAI models.

Make sure to load these using Python's `dotenv`:

```python
from dotenv import load_dotenv
load_dotenv()
```

### 🔗 LangChain ReAct Agent

```python
from dotenv import load_dotenv
from langgraph.prebuilt import create_react_agent

from examples.utils import print_agent_response
from trim import TrimChatModel

load_dotenv()


def calculator(expression: str) -> str:
    """Evaluates a basic math expression."""
    try:
        return str(eval(expression))
    except Exception as e:
        return f"Error: {e}"


llm = TrimChatModel()

agent = create_react_agent(model=llm, tools=[calculator])

response = agent.invoke({"messages": "What is (12 * 3) + 5?"})
print_agent_response(response['messages'])
```

---

### 💬 LangChain `ChatModel`

```python
from trim import TrimChatModel
from dotenv import load_dotenv

load_dotenv()

llm = TrimChatModel()

response = llm.invoke([
    {"role": "user", "content": "Tell me about Elon Musk in 20 words"}
])

print(response.content)
```

---

### 🧩 OpenAI-Compatible API

```python
from trim import TrimClient
from dotenv import load_dotenv

load_dotenv()

client = TrimClient()

# Way 1: Simple completion
completion = client.responses.create(
    model="gpt-4.1",
    input="Write a one-sentence bedtime story about a unicorn."
)
print(completion.output_text)

# Way 2: Chat completion
completion = client.chat.completions.create(
    model="gpt-4.1",
    messages=[{"role": "user", "content": "Write a one-sentence bedtime story about bears"}]
)
print(completion.choices[0].message.content)
```

---

### 🧠 LangChain `LLM` Wrapper

```python
from trim import TrimLLM
from dotenv import load_dotenv

load_dotenv()

llm = TrimLLM()

prompt = "Explain quantum computing in less than 20 words."

result = llm.invoke(prompt)
print(result)
```

---

## 📚 Documentation

Coming soon. For now, explore the `examples/` directory for use cases and integration patterns.

---

## 🤝 Contributing

Contributions are welcome! Please open issues or submit pull requests.

---

## 🛡️ License

MIT License
gridpointcode-algo-pranavpatel-ca 1.0
Grid Point Code (GPC) is a global geocoding system that provides a unique, lossless, and compact alphanumeric code for any geographic location (home, office, or other places). It enables precise identification and offline conversion between geographic coordinates and codes.
Requires Python: >=3.6

# Grid Point Code (GPC) – Python

## Overview

Grid Point Code (GPC) is a geocoding system that provides a unique, compact, and lossless alphanumeric code for any global geographic location. This Python implementation allows offline encoding and decoding between latitude/longitude coordinates and GPCs with high precision.

## Features

* **Unique Global Codes:** Every location is mapped to a unique alphanumeric string.
* **Lossless Bi-directional Conversion:** Accurate up to 5 decimal places.
* **Offline Functionality:** No network access required.
* **Formatted Output:** Standardized format: `#XXXX-XXXX-XXX`.
* **Proximity Awareness:** Similar codes correspond to nearby locations.
* **Open Source:** Available under the Apache License 2.0.

## How It Works

* **Encoding:** Converts latitude and longitude into an 11-character base-27 alphanumeric code.
* **Decoding:** Converts a GPC string back to geographic coordinates.
* **Validation:** Ensures coordinates and codes fall within valid ranges.
* **Formatting:** Adds visual separators to GPCs for readability.

## Installation

Install from PyPI:

```bash
pip install gridpointcode-algo-pranavpatel-ca
```

## Usage

### Encoding Coordinates

```python
from gridpointcode_algo_pranavpatel_ca import GPC

# Encode latitude and longitude into GPC
gpc_code = GPC.encode(43.65000, -79.38000)  # Toronto
print(gpc_code)  # Output: #FN5G-CDKL-HDC
```

### Decoding a GPC

```python
# Decode GPC into latitude and longitude
lat, lng = GPC.decode("#FN5G-CDKL-HDC")
print(lat, lng)
```

### Validating a GPC

```python
# Validate GPC format and range
valid, message = GPC.is_valid_gpc("#FN5G-CDKL-HDC")
print(valid, message)
```

## Code Format

* **GPC Structure:** `#XXXX-XXXX-XXX` (11 base-27 characters)
* **Alphabet:** `"CDFGHJKLMNPRTVWXY0123456789"` (base-27)
* **Precision:** Approx. 5 decimal places in latitude/longitude

## License

Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

## Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on GitHub.