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
29 changes: 29 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check

on:
pull_request:
branches: [main]
push:
branches: [main]

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
run: uv python install 3.11

- name: Install dependencies
run: uv sync --all-extras

- name: Run checks
run: make check
Comment thread Fixed
12 changes: 5 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
run: uv python install 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-asyncio
run: uv sync --all-extras

- name: Run tests
run: make test
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

OpenGradient Python SDK - A decentralized model management and inference platform SDK. The SDK enables programmatic access to model repositories and decentralized AI infrastructure, including end-to-end verified AI execution. Use virtualenv for dependency management locally (in `venv` folder).
OpenGradient Python SDK - A decentralized model management and inference platform SDK. The SDK enables programmatic access to model repositories and decentralized AI infrastructure, including end-to-end verified AI execution. Uses `uv` for dependency management.

## Development Commands

### Build & Installation
```bash
# Install in development mode
pip install -e .
# Install dependencies (syncs from pyproject.toml/uv.lock)
make install # or: uv sync --all-extras

# Build distribution
make build
Expand Down
36 changes: 18 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@ MODEL ?= google/gemini-3-pro-preview
# ============================================================================

install:
pip install -e .
uv sync --all-extras

build:
python -m build
uv build

publish:
@echo "Current version:" $$(grep 'version = ' pyproject.toml | cut -d'"' -f2)
rm -rf dist/*
python -m build
twine upload dist/*
uv build
uv publish

check:
ruff format .
mypy src
mypy examples
uv run ruff format .
uv run mypy src
uv run mypy examples

docs:
pdoc opengradient -o docs --template-dir ./templates --force
uv run pdoc opengradient -o docs --template-dir ./templates --force

# ============================================================================
# Testing
# ============================================================================

test:
pytest tests/ -v
uv run pytest tests/ -v

integrationtest:
python integrationtest/agent/test_agent.py
python integrationtest/workflow_models/test_workflow_models.py
uv run python integrationtest/agent/test_agent.py
uv run python integrationtest/workflow_models/test_workflow_models.py

examples:
@for f in $$(find examples -name '*.py' | sort); do \
echo "Running $$f..."; \
python "$$f" || exit 1; \
uv run python "$$f" || exit 1; \
done
@echo "All examples passed."

Expand All @@ -50,38 +50,38 @@ examples:
# ============================================================================

infer:
python -m opengradient.cli infer \
uv run python -m opengradient.cli infer \
-m "hJD2Ja3akZFt1A2LT-D_1oxOCz_OtuGYw4V9eE1m39M" \
--input '{"open_high_low_close": [[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4],[1,2,3,4]]}'

completion:
python -m opengradient.cli completion \
uv run python -m opengradient.cli completion \
--model $(MODEL) \
--prompt "Hello, how are you?" \
--max-tokens 50

chat:
python -m opengradient.cli chat \
uv run python -m opengradient.cli chat \
--model $(MODEL) \
--messages '[{"role":"user","content":"Tell me a fun fact"}]' \
--max-tokens 350

chat-stream:
python -m opengradient.cli chat \
uv run python -m opengradient.cli chat \
--model $(MODEL) \
--messages '[{"role":"user","content":"Tell me a short story"}]' \
--max-tokens 1250 \
--stream

chat-tool:
python -m opengradient.cli chat \
uv run python -m opengradient.cli chat \
--model $(MODEL) \
--messages '[{"role":"system","content":"You are a helpful assistant. Use tools when needed."},{"role":"user","content":"What'\''s the weather like in Dallas, Texas? Give me the temperature in fahrenheit."}]' \
--tools '[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"city":{"type":"string"},"state":{"type":"string"},"unit":{"type":"string","enum":["fahrenheit","celsius"]}},"required":["city","state","unit"]}}}]' \
--max-tokens 200

chat-stream-tool:
python -m opengradient.cli chat \
uv run python -m opengradient.cli chat \
--model $(MODEL) \
--messages '[{"role":"system","content":"You are a helpful assistant. Use tools when needed."},{"role":"user","content":"What'\''s the weather like in Dallas, Texas? Give me the temperature in fahrenheit."}]' \
--tools '[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"city":{"type":"string"},"state":{"type":"string"},"unit":{"type":"string","enum":["fahrenheit","celsius"]}},"required":["city","state","unit"]}}}]' \
Expand Down
5 changes: 0 additions & 5 deletions dev-requirements.txt

This file was deleted.

11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ dependencies = [
"og-x402==0.0.1.dev2"
]

[project.optional-dependencies]
dev = [
"ruff",
"mypy",
"pytest",
"pytest-asyncio",
"langgraph",
"pdoc3==0.10.0",
"types-protobuf",
]

[project.scripts]
opengradient = "opengradient.cli:cli"

Expand Down
10 changes: 0 additions & 10 deletions requirements.txt

This file was deleted.

Loading
Loading