Skip to content

Commit 1530fed

Browse files
jkwatsonCopilot
andauthored
a few tweaks for better logging & old CML/crew support (#231)
* a few tweaks for better logging & old CML/crew support * add pysqllite3 as a dep for Linux * add pysqllite3-binary to the deps, and put the import into a try/except * ruff * print out the system platform for debugging purposes * Update llm-service/app/main.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * address deprecation issues --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent ccda7fe commit 1530fed

File tree

5 files changed

+3202
-3018
lines changed

5 files changed

+3202
-3018
lines changed

llm-service/app/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import functools
4040
import logging
4141
import os
42+
import platform
4243
import sys
4344
import time
4445
from collections.abc import Awaitable, Callable
@@ -58,6 +59,12 @@
5859
logger = logging.getLogger(__name__)
5960
_request_received_logger = logging.getLogger(_APP_PKG_NAME + ".access")
6061

62+
try:
63+
# Manual patch required for CrewAI compatability. DO NOT REMOVE. IT BREAKS ON OLD RUNTIMES IF YOU DO
64+
__import__("pysqlite3")
65+
sys.modules["sqlite3"] = sys.modules.pop("pysqlite3")
66+
except Exception as e:
67+
logger.info(f"Unable to swap out pysqlite3. Probably not installed on your platform: {platform.system()}", e)
6168

6269
def _configure_logger() -> None:
6370
"""Configure this module's setup/teardown logging formatting and verbosity."""

llm-service/app/services/query/agents/planner_agent.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
from crewai import Agent, Task, Crew, Process
4343
from llama_index.core.base.llms.types import ChatMessage, MessageRole
4444
from llama_index.core.llms import LLM
45-
from pydantic import BaseModel, Field
45+
from pydantic import BaseModel, Field, ConfigDict
4646

4747
from app.services.models.providers import BedrockModelProvider, AzureModelProvider
4848
from app.services.query.agents.models import get_crewai_llm_object_direct
@@ -66,21 +66,21 @@ class PlannerTaskOutput(BaseModel):
6666
The output of the planner agent.
6767
"""
6868

69+
model_config = ConfigDict(json_schema_extra = {
70+
"example": {
71+
"use_retrieval": True,
72+
"explanation": "The query is related to the content described in the knowledge base summary.",
73+
}
74+
}
75+
)
76+
6977
use_retrieval: bool = Field(
7078
..., description="Whether to use retrieval or answer directly."
7179
)
7280
explanation: str = Field(
7381
..., description="Explanation for the decision made by the planner agent."
7482
)
7583

76-
class Config:
77-
schema_extra = {
78-
"example": {
79-
"use_retrieval": True,
80-
"explanation": "The query is related to the content described in the knowledge base summary.",
81-
}
82-
}
83-
8484

8585
class PlannerAgent:
8686
"""

llm-service/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dependencies = [
4646
"llama-index-callbacks-opik>=1.1.0",
4747
"mcp[cli]>=1.9.1",
4848
"crewai-tools[mcp]>=0.44.0",
49+
"pysqlite3-binary==0.5.4; platform_system == 'Linux'",
4950
]
5051
requires-python = ">=3.10,<=3.12"
5152
readme = "README.md"

0 commit comments

Comments
 (0)