@@ -34,7 +34,7 @@ make integrationtest
3434
3535### Code Quality
3636``` bash
37- # Run linting and formatting (uses ruff )
37+ # Run formatting (ruff, line-length=140) and type checking (mypy )
3838make check
3939
4040# Generate documentation
@@ -52,31 +52,32 @@ make completion
5252# Test chat functionality
5353make chat
5454
55- # Test tool usage
56- make tool
55+ # Test streaming chat
56+ make chat-stream
5757
58- # Test TEE mode
59- make tee_completion
60- make tee_chat
58+ # Test tool calling
59+ make chat-tool
6160```
6261
6362## Architecture Overview
6463
6564### Core Components
6665
67- 1 . ** Client (` src/opengradient/client.py ` )** : Central client class managing authentication and API interactions
68- - Handles Model Hub authentication (email/password)
69- - Manages blockchain interactions (private key)
70- - Provides high-level APIs for model management and inference
66+ 1 . ** Client (` src/opengradient/client/ ` )** : Client package with submodules
67+ - ` client.py ` — Main Client class, authentication, initialization
68+ - ` llm.py ` — LLM chat/completion with TEE and x402 payment support
69+ - ` model_hub.py ` — Model repository management (CRUD, upload)
70+ - ` twins.py ` — Digital twins chat integration (twin.fun)
71+ - ` alpha.py ` — Alpha Testnet on-chain inference and workflows
72+ - ` opg_token.py ` — OPG token Permit2 approval
73+ - ` exceptions.py ` — Custom exception classes
7174
72752 . ** CLI (` src/opengradient/cli.py ` )** : Command-line interface using Click
7376 - Commands: ` config ` , ` infer ` , ` completion ` , ` chat `
7477 - Supports file-based input for messages and tools
7578
76- 3 . ** LLM Module (` src/opengradient/llm/ ` )** : Language model specific functionality
77- - Chat completions
78- - Tool calling support
79- - Streaming responses
79+ 3 . ** Agents (` src/opengradient/agents/ ` )** : Framework integrations
80+ - ` og_langchain.py ` — LangChain ChatModel adapter
8081
81824 . ** Blockchain Integration** :
8283 - Smart contract ABIs in ` src/opengradient/abi/ `
@@ -85,11 +86,20 @@ make tee_chat
8586
86875 . ** Protocol Buffers (` src/opengradient/proto/ ` )** : gRPC service definitions for inference
8788
89+ 6 . ** AlphaSense (` src/opengradient/alphasense/ ` )** : LangChain-compatible tools for AI agents
90+ - ` run_model_tool.py ` — Tool for running on-chain model inference
91+ - ` read_workflow_tool.py ` — Tool for reading workflow results
92+
93+ 7 . ** Workflow Models (` src/opengradient/workflow_models/ ` )** : Hardcoded price/volatility forecast models for on-chain execution
94+
8895### Key Concepts
8996
90- - ** Inference Modes** : VANILLA, TEE (end-to-end verified)
97+ - ** Inference Modes** : VANILLA, TEE (end-to-end verified), ZKML
9198- ** Model CID** : Content-addressed model identifiers
9299- ** Dual Authentication** : Model Hub (email/password) + blockchain (private key)
100+ - ** x402 Payments** : Streamed micropayment protocol for LLM inference
101+ - ** Digital Twins** : Chat integration with twin.fun personas
102+ - ** Dual Chain** : Base Sepolia (LLM) + OpenGradient testnet (Alpha on-chain inference)
93103
94104## Configuration
95105
@@ -102,9 +112,11 @@ User configuration stored via `opengradient config init` wizard.
102112
103113## Testing Strategy
104114
105- - Unit tests: ` tests/utils_test.py ` using pytest
115+ - Unit tests in ` tests/ ` using pytest: ` utils_test.py ` , ` client_test.py ` , ` langchain_adapter_test.py ` , ` opg_token_test.py `
106116- Integration tests: ` integrationtest/ ` for agent and workflow models
117+ - Stress tests: ` stresstest/ ` for load testing LLM and inference endpoints
107118- CLI command testing via Makefile targets
119+ - Run individual suites: ` make client_test ` , ` make langchain_adapter_test ` , ` make opg_token_test `
108120
109121## Documentation (pdoc)
110122
@@ -135,9 +147,11 @@ The template's `linkify` function automatically converts `` `opengradient.x.y.z`
135147
136148## Dependencies
137149
138- Key dependencies (Python >=3.10 ):
150+ Key dependencies (Python >=3.11 ):
139151- ` web3 ` & ` eth-account ` : Blockchain interaction
140- - ` grpcio ` : Service communication
141152- ` langchain ` & ` openai ` : LLM integrations
142153- ` click ` : CLI framework
143- - ` firebase-rest-api ` : Backend services
154+ - ` firebase-rest-api ` : Backend services
155+ - ` pydantic ` : Data validation
156+ - ` og-test-v2-x402 ` : x402 payment protocol
157+ - ` numpy ` : Array handling
0 commit comments