Skip to content
This repository was archived by the owner on Feb 3, 2026. It is now read-only.

Commit 3fef7b1

Browse files
committed
Add LLM reasonning and MCP configuration
Signed-off-by: Herklos <herklos@drakkar.software>
1 parent d48f88f commit 3fef7b1

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Added
99
- pydantic to requirements
1010
- add AbstractAIService
11+
- MCP server interface
1112

1213
## [1.7.2] - 2026-01-25
1314
### Added
@@ -63,7 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6364

6465
## [1.6.21] - 2023-10-21
6566
### Added
66-
[Constant] add CONIG_LLM_CUSTOM_BASE_URL
67+
[Constant] add CONFIG_LLM_CUSTOM_BASE_URL
6768

6869
## [1.6.20] - 2023-10-07
6970
### Added

full_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ flask-socketio==5.5.1
4242
openai==2.15.0
4343
# agents
4444
pydantic==2.12.5
45+
mcp==1.26.0
4546
# Coingecko
4647
coingecko-openapi-client>=1.3.0
4748
# Analysis tools

octobot_services/constants.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,23 @@
8383
CONFIG_LLM_CUSTOM_BASE_URL = "llm-custom-base-url"
8484
CONFIG_LLM_MODEL = "llm-model"
8585
CONFIG_LLM_DAILY_TOKENS_LIMIT = "llm-daily-tokens-limit"
86+
CONFIG_LLM_SHOW_REASONING = "llm-show-reasoning"
87+
CONFIG_LLM_REASONING_EFFORT = "llm-reasoning-effort"
88+
CONFIG_LLM_MCP_SERVERS = "llm-mcp-servers"
89+
CONFIG_LLM_AUTO_INJECT_MCP_TOOLS = "llm-auto-inject-mcp-tools"
8690
ENV_OPENAI_SECRET_KEY = "OPENAI_SECRET_KEY"
8791
ENV_GPT_MODEL = "GPT_MODEL"
8892
ENV_GPT_DAILY_TOKENS_LIMIT = "GPT_DAILY_TOKEN_LIMIT"
8993

94+
# MCP
95+
CONFIG_MCP = "mcp"
96+
CONFIG_MCP_IP = "ip"
97+
CONFIG_MCP_PORT = "port"
98+
ENV_MCP_PORT = "MCP_PORT"
99+
ENV_MCP_ADDRESS = "MCP_ADDRESS"
100+
DEFAULT_MCP_IP = '127.0.0.1'
101+
DEFAULT_MCP_PORT = 3001
102+
90103
# Google
91104
CONFIG_GOOGLE = "google"
92105
CONFIG_TREND_TOPICS = "trends"

octobot_services/services/abstract_ai_service.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ async def get_completion(
3838
temperature: float = 0.5,
3939
json_output: bool = False,
4040
response_schema: typing.Optional[typing.Any] = None,
41-
) -> typing.Optional[str]:
41+
tools: typing.Optional[list] = None,
42+
tool_choice: typing.Optional[typing.Union[str, dict]] = None,
43+
use_octobot_mcp: typing.Optional[bool] = None,
44+
) -> typing.Union[str, dict, None]:
4245
"""
4346
Get a completion from the LLM.
4447
@@ -52,9 +55,21 @@ async def get_completion(
5255
json_output: Whether to return JSON formatted output.
5356
response_schema: Optional Pydantic model or JSON schema dict
5457
for structured output validation.
58+
tools: Optional list of tool definitions for function calling.
59+
Each tool should be a dict with 'type' and 'function' keys.
60+
tool_choice: Optional control for tool usage. Can be "auto", "none",
61+
or a dict specifying a specific tool.
62+
use_octobot_mcp: Optional bool to include OctoBot MCP server tools.
63+
If True, automatically discovers and includes tools from OctoBot MCP interface.
64+
If None, uses default behavior (does not include OctoBot MCP).
65+
If False, explicitly excludes OctoBot MCP tools.
5566
5667
Returns:
57-
The completion text, or None if an error occurred.
68+
str: The completion text when no tools are used or tool_choice is "none".
69+
dict: When tools are used and model makes tool calls, returns dict with:
70+
- "content": str | None (may be None if only tool calls)
71+
- "tool_calls": list of tool call dicts with id, type, function keys
72+
None: On error
5873
5974
Raises:
6075
InvalidRequestError: If the request is malformed.

0 commit comments

Comments
 (0)