Dmitry Beresnev commited on
Commit ·
2c2fd9d
1
Parent(s): 07df346
add my custom LLM server
Browse files- README.md +10 -0
- config/openclaw.env.example +4 -0
- openclaw.llamacpp.json +74 -0
- openclaw.researchengineering.json +94 -0
README.md
CHANGED
|
@@ -26,9 +26,19 @@ This Space hosts the OpenClaw trading bot (paper-only). The LLM runs in a separa
|
|
| 26 |
- Expected to expose a simple HTTP inference endpoint.
|
| 27 |
- The bot calls `${LLM_SPACE_URL}` (see `config/openclaw.env.example`) and expects a JSON response with an output string.
|
| 28 |
- Update `LLM_SPACE_URL` and response path in `openclaw.json` to match your existing LLM Space.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
**Key Files**
|
| 31 |
- `openclaw.json` defines providers, routing, tools, memory, and safety.
|
|
|
|
|
|
|
| 32 |
- `app.py` provides gateway controls and strategy backtesting UI.
|
| 33 |
- `tools/backtesting_runner.py` implements SMA crossover test runners for `backtesting.py` and `backtrader`.
|
| 34 |
- `config/openclaw.env.example` lists all required env vars.
|
|
|
|
| 26 |
- Expected to expose a simple HTTP inference endpoint.
|
| 27 |
- The bot calls `${LLM_SPACE_URL}` (see `config/openclaw.env.example`) and expects a JSON response with an output string.
|
| 28 |
- Update `LLM_SPACE_URL` and response path in `openclaw.json` to match your existing LLM Space.
|
| 29 |
+
- For OpenAI-compatible llama.cpp endpoints, use `openclaw.llamacpp.json` and set:
|
| 30 |
+
- `LLM_SPACE_OPENAI_URL=https://researchengineering-agi.hf.space/v1/chat/completions`
|
| 31 |
+
- `LLM_MODEL` (for example `deepseek-chat`)
|
| 32 |
+
- `LLM_SPACE_API_KEY` if your endpoint requires auth
|
| 33 |
+
- For your AGI Multi-Model API spec, use `openclaw.researchengineering.json`:
|
| 34 |
+
- `LLM_SPACE_OPENAI_URL=https://researchengineering-agi.hf.space/v1/chat/completions`
|
| 35 |
+
- `LLM_SPACE_WEBCHAT_URL=https://researchengineering-agi.hf.space/v1/web-chat/completions`
|
| 36 |
+
- `response_path=choices.0.message.content`
|
| 37 |
|
| 38 |
**Key Files**
|
| 39 |
- `openclaw.json` defines providers, routing, tools, memory, and safety.
|
| 40 |
+
- `openclaw.llamacpp.json` is prewired for OpenAI-compatible endpoints (llama.cpp style).
|
| 41 |
+
- `openclaw.researchengineering.json` is prewired for your AGI Multi-Model API.
|
| 42 |
- `app.py` provides gateway controls and strategy backtesting UI.
|
| 43 |
- `tools/backtesting_runner.py` implements SMA crossover test runners for `backtesting.py` and `backtrader`.
|
| 44 |
- `config/openclaw.env.example` lists all required env vars.
|
config/openclaw.env.example
CHANGED
|
@@ -1,5 +1,9 @@
|
|
| 1 |
# LLM Space (external)
|
| 2 |
LLM_SPACE_URL=https://your-llm-space.hf.space/api/predict
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Alpaca paper trading
|
| 5 |
ALPACA_API_KEY=your_key
|
|
|
|
| 1 |
# LLM Space (external)
|
| 2 |
LLM_SPACE_URL=https://your-llm-space.hf.space/api/predict
|
| 3 |
+
LLM_SPACE_OPENAI_URL=https://researchengineering-agi.hf.space/v1/chat/completions
|
| 4 |
+
LLM_SPACE_WEBCHAT_URL=https://researchengineering-agi.hf.space/v1/web-chat/completions
|
| 5 |
+
LLM_SPACE_API_KEY=
|
| 6 |
+
LLM_MODEL=deepseek-chat
|
| 7 |
|
| 8 |
# Alpaca paper trading
|
| 9 |
ALPACA_API_KEY=your_key
|
openclaw.llamacpp.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"agent": {
|
| 3 |
+
"name": "openclaw-trading-bot",
|
| 4 |
+
"description": "OpenClaw bot for paper trading with llama.cpp/OpenAI-compatible external LLM Space",
|
| 5 |
+
"timezone": "UTC"
|
| 6 |
+
},
|
| 7 |
+
"providers": [
|
| 8 |
+
{
|
| 9 |
+
"name": "hf_llamacpp_openai",
|
| 10 |
+
"type": "custom_http",
|
| 11 |
+
"base_url": "${LLM_SPACE_OPENAI_URL}",
|
| 12 |
+
"method": "POST",
|
| 13 |
+
"timeout_ms": 30000,
|
| 14 |
+
"headers": {
|
| 15 |
+
"Content-Type": "application/json",
|
| 16 |
+
"Authorization": "Bearer ${LLM_SPACE_API_KEY}"
|
| 17 |
+
},
|
| 18 |
+
"request_schema": {
|
| 19 |
+
"model": "${LLM_MODEL}",
|
| 20 |
+
"messages": [
|
| 21 |
+
{
|
| 22 |
+
"role": "user",
|
| 23 |
+
"content": "${prompt}"
|
| 24 |
+
}
|
| 25 |
+
],
|
| 26 |
+
"temperature": 0.2,
|
| 27 |
+
"max_tokens": 700
|
| 28 |
+
},
|
| 29 |
+
"response_path": "choices.0.message.content"
|
| 30 |
+
}
|
| 31 |
+
],
|
| 32 |
+
"routing": {
|
| 33 |
+
"market_analysis": "hf_llamacpp_openai",
|
| 34 |
+
"signal_generation": "hf_llamacpp_openai",
|
| 35 |
+
"reporting": "hf_llamacpp_openai"
|
| 36 |
+
},
|
| 37 |
+
"tools": {
|
| 38 |
+
"alpaca_paper": {
|
| 39 |
+
"type": "python",
|
| 40 |
+
"module": "tools.alpaca_paper",
|
| 41 |
+
"env": [
|
| 42 |
+
"ALPACA_API_KEY",
|
| 43 |
+
"ALPACA_API_SECRET",
|
| 44 |
+
"ALPACA_BASE_URL"
|
| 45 |
+
]
|
| 46 |
+
},
|
| 47 |
+
"hf_storage": {
|
| 48 |
+
"type": "python",
|
| 49 |
+
"module": "tools.hf_storage",
|
| 50 |
+
"env": [
|
| 51 |
+
"HF_TOKEN",
|
| 52 |
+
"HF_TRADES_REPO"
|
| 53 |
+
]
|
| 54 |
+
},
|
| 55 |
+
"market_data": {
|
| 56 |
+
"type": "python",
|
| 57 |
+
"module": "tools.market_data",
|
| 58 |
+
"env": [
|
| 59 |
+
"MARKET_DATA_SOURCE"
|
| 60 |
+
]
|
| 61 |
+
}
|
| 62 |
+
},
|
| 63 |
+
"memory": {
|
| 64 |
+
"type": "sqlite",
|
| 65 |
+
"path": "/data/openclaw_memory.sqlite",
|
| 66 |
+
"max_tokens": 1200
|
| 67 |
+
},
|
| 68 |
+
"safety": {
|
| 69 |
+
"paper_only": true,
|
| 70 |
+
"max_order_qty": 5,
|
| 71 |
+
"max_position_usd": 5000,
|
| 72 |
+
"require_signal": true
|
| 73 |
+
}
|
| 74 |
+
}
|
openclaw.researchengineering.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"agent": {
|
| 3 |
+
"name": "openclaw-trading-bot",
|
| 4 |
+
"description": "OpenClaw bot for paper trading with ResearchEngineering AGI Multi-Model API",
|
| 5 |
+
"timezone": "UTC"
|
| 6 |
+
},
|
| 7 |
+
"providers": [
|
| 8 |
+
{
|
| 9 |
+
"name": "agi_chat",
|
| 10 |
+
"type": "custom_http",
|
| 11 |
+
"base_url": "${LLM_SPACE_OPENAI_URL}",
|
| 12 |
+
"method": "POST",
|
| 13 |
+
"timeout_ms": 30000,
|
| 14 |
+
"headers": {
|
| 15 |
+
"Content-Type": "application/json"
|
| 16 |
+
},
|
| 17 |
+
"request_schema": {
|
| 18 |
+
"messages": [
|
| 19 |
+
{
|
| 20 |
+
"role": "user",
|
| 21 |
+
"content": "${prompt}"
|
| 22 |
+
}
|
| 23 |
+
],
|
| 24 |
+
"max_tokens": 700,
|
| 25 |
+
"temperature": 0.2
|
| 26 |
+
},
|
| 27 |
+
"response_path": "choices.0.message.content"
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"name": "agi_web_chat",
|
| 31 |
+
"type": "custom_http",
|
| 32 |
+
"base_url": "${LLM_SPACE_WEBCHAT_URL}",
|
| 33 |
+
"method": "POST",
|
| 34 |
+
"timeout_ms": 45000,
|
| 35 |
+
"headers": {
|
| 36 |
+
"Content-Type": "application/json"
|
| 37 |
+
},
|
| 38 |
+
"request_schema": {
|
| 39 |
+
"messages": [
|
| 40 |
+
{
|
| 41 |
+
"role": "user",
|
| 42 |
+
"content": "${prompt}"
|
| 43 |
+
}
|
| 44 |
+
],
|
| 45 |
+
"max_tokens": 700,
|
| 46 |
+
"temperature": 0.2,
|
| 47 |
+
"max_search_results": 5
|
| 48 |
+
},
|
| 49 |
+
"response_path": "choices.0.message.content"
|
| 50 |
+
}
|
| 51 |
+
],
|
| 52 |
+
"routing": {
|
| 53 |
+
"market_analysis": "agi_web_chat",
|
| 54 |
+
"signal_generation": "agi_chat",
|
| 55 |
+
"reporting": "agi_chat"
|
| 56 |
+
},
|
| 57 |
+
"tools": {
|
| 58 |
+
"alpaca_paper": {
|
| 59 |
+
"type": "python",
|
| 60 |
+
"module": "tools.alpaca_paper",
|
| 61 |
+
"env": [
|
| 62 |
+
"ALPACA_API_KEY",
|
| 63 |
+
"ALPACA_API_SECRET",
|
| 64 |
+
"ALPACA_BASE_URL"
|
| 65 |
+
]
|
| 66 |
+
},
|
| 67 |
+
"hf_storage": {
|
| 68 |
+
"type": "python",
|
| 69 |
+
"module": "tools.hf_storage",
|
| 70 |
+
"env": [
|
| 71 |
+
"HF_TOKEN",
|
| 72 |
+
"HF_TRADES_REPO"
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
"market_data": {
|
| 76 |
+
"type": "python",
|
| 77 |
+
"module": "tools.market_data",
|
| 78 |
+
"env": [
|
| 79 |
+
"MARKET_DATA_SOURCE"
|
| 80 |
+
]
|
| 81 |
+
}
|
| 82 |
+
},
|
| 83 |
+
"memory": {
|
| 84 |
+
"type": "sqlite",
|
| 85 |
+
"path": "/data/openclaw_memory.sqlite",
|
| 86 |
+
"max_tokens": 1200
|
| 87 |
+
},
|
| 88 |
+
"safety": {
|
| 89 |
+
"paper_only": true,
|
| 90 |
+
"max_order_qty": 5,
|
| 91 |
+
"max_position_usd": 5000,
|
| 92 |
+
"require_signal": true
|
| 93 |
+
}
|
| 94 |
+
}
|