Removed llm config

This commit is contained in:
Viswamedha Nalabotu 2026-03-22 19:35:07 +00:00
parent a6fe130307
commit 5280433c8f
11 changed files with 12 additions and 80 deletions

View file

@ -143,8 +143,7 @@ def create_default_agents_for_role(sender, instance: Role, created: bool, **kwar
role=instance,
name=agent_data['name'],
agent_type=agent_data['type'],
system_prompt=agent_data['prompt'],
llm_config={"model_id": "meta-llama-3.1-8b-instruct"}
system_prompt=agent_data['prompt']
)
@receiver(post_delete, sender=Role)

View file

@ -19,7 +19,7 @@ class AgentConfigAdmin(admin.ModelAdmin):
search_fields = ('name', 'system_prompt')
readonly_fields = ('uuid', 'created_at', 'updated_at')
fieldsets = (
(None, {'fields': ('name', 'agent_type', 'organization', 'uuid', 'system_prompt', 'llm_config')}),
(None, {'fields': ('name', 'agent_type', 'organization', 'uuid', 'system_prompt')}),
(_('Agent Logic'), {'fields': ()}),
(_('Metadata'), {'fields': ('created_at', 'updated_at')}),
)

View file

@ -82,13 +82,12 @@ class BaseOnboardingConsumer(AsyncWebsocketConsumer):
"""
Orchestrates a multi-turn conversation with the agent, including tool calls and reasoning steps.
"""
llm_config = config.llm_config if isinstance(config.llm_config, dict) else {}
resolved_max_tokens = max_tokens or llm_config.get("max_tokens", 1024)
resolved_max_tokens = max_tokens or 1024
messages = [
{"role": "system", "content": config.system_prompt or OnboardingPrompts.default_system_prompt()},
{"role": "user", "content": message}
]
last_content = ""
last_content = ""
async with httpx.AsyncClient(timeout=request_timeout, auth=settings.INFERENCE_AUTH) as client:
for turn in range(1, maximum_turns + 1):
await self.send_log(LogType.THOUGHT, f"Agent reasoning (Turn {turn})...")
@ -96,7 +95,6 @@ class BaseOnboardingConsumer(AsyncWebsocketConsumer):
response = await client.post(
settings.INFERENCE_CHAT_COMPLETIONS_ENDPOINT,
json={
"model": llm_config.get("model_id", "meta-llama-3.1-8b"),
"messages": messages,
"tools": self.router.get_tool_definitions(),
"tool_choice": "auto",
@ -143,9 +141,7 @@ class BaseOnboardingConsumer(AsyncWebsocketConsumer):
system_prompt = config.system_prompt or OnboardingPrompts.default_system_prompt()
if system_prompt_suffix:
system_prompt = system_prompt + "\n\n" + system_prompt_suffix
llm_config = config.llm_config if isinstance(config.llm_config, dict) else {}
payload: dict = {
"model": llm_config.get("model_id", "meta-llama-3.1-8b"),
"messages": [
{"role": "system", "content": system_prompt},
{"role": "user", "content": prompt},

View file

@ -99,9 +99,7 @@ class OnboardingKnowledgeConsumer(BaseOnboardingConsumer):
if not config:
return None
system_prompt = config.system_prompt or OnboardingPrompts.FALLBACK_SYSTEM_PROMPT
llm_config = config.llm_config if isinstance(config.llm_config, dict) else {}
payload: dict = {
'model': llm_config.get('model_id', 'meta-llama-3.1-8b'),
'messages': [
{'role': 'system', 'content': system_prompt},
{'role': 'user', 'content': prompt},

View file

@ -23,7 +23,6 @@ class Migration(migrations.Migration):
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')),
('name', models.CharField(max_length=255, verbose_name='Agent Name')),
('agent_type', models.CharField(choices=[('curriculum', 'Curriculum Agent (CA)'), ('knowledge', 'Knowledge Agent (KA)'), ('assessment', 'Assessment Agent (AA)'), ('monitor', 'Progress Monitor Agent (PMA)')], max_length=40, verbose_name='Agent Type')),
('llm_config', models.JSONField(blank=True, default=dict, null=True, verbose_name='LLM Configuration')),
('system_prompt', models.TextField(blank=True, default='', verbose_name='System Prompt')),
('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='agent_configs', to='accounts.organization', verbose_name='Organization')),
('role', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='agent_configs', to='accounts.role', verbose_name='Role')),

View file

@ -16,7 +16,6 @@ class AgentConfig(IdentifierMixin, TimeStampMixin, Model):
role = ForeignKey(Role, on_delete=CASCADE, related_name='agent_configs', verbose_name=_("Role"), null=True, blank=True)
name = CharField(max_length=255, verbose_name=_("Agent Name"))
agent_type = CharField(max_length=40, choices=AGENT_TYPES, verbose_name=_("Agent Type"))
llm_config = JSONField(default=dict, blank=True, null=True, verbose_name=_("LLM Configuration"))
system_prompt = TextField(verbose_name=_("System Prompt"), blank=True, default='')

View file

@ -11,8 +11,7 @@ class AgentConfigSerializer(ModelSerializer):
model = AgentConfig
fields = [
'id', 'uuid', 'organization', 'role', 'name', 'agent_type',
'system_prompt', 'llm_config',
'created_at', 'updated_at'
'system_prompt', 'created_at', 'updated_at'
]
read_only_fields = ['id', 'uuid', 'created_at', 'updated_at']

View file

@ -72,7 +72,6 @@ class OnboardingApiTests(TestCase):
'name': 'Coordinator Monitor',
'agent_type': 'monitor',
'system_prompt': 'Monitor progress',
'llm_config': {'model': 'local'},
}, format='json')
self.assertEqual(response.status_code, HTTP_201_CREATED)
@ -89,7 +88,6 @@ class OnboardingApiTests(TestCase):
'name': 'Coordinator Knowledge Updated',
'agent_type': 'knowledge',
'system_prompt': 'Updated',
'llm_config': {'model': 'local'},
},
format='json',

View file

@ -25,14 +25,12 @@ class OnboardingModelTests(TestCase):
organization=self.org,
name='Operator Knowledge Agent',
agent_type='knowledge',
llm_config={'model_id': 'x'},
system_prompt='Assist user'
)
self.assertEqual(config.organization, self.org)
self.assertEqual(config.name, 'Operator Knowledge Agent')
self.assertEqual(config.agent_type, 'knowledge')
self.assertEqual(config.llm_config, {'model_id': 'x'})
self.assertEqual(config.system_prompt, 'Assist user')
self.assertIsNotNone(config.id)
self.assertIsNotNone(config.uuid)

View file

@ -18,7 +18,7 @@ from rest_framework.status import (
)
from rest_framework.viewsets import ModelViewSet, ReadOnlyModelViewSet
from apps.accounts.models import Organization, Role
from apps.accounts.models import Organization, Role, User
from apps.accounts.permissions import CanManageOrganization, can_manage_organization
from apps.onboarding.consumers.prompts import OnboardingPrompts
from apps.onboarding.mixins import RequestParamMixin
@ -244,8 +244,7 @@ class AgentConfigViewSet(RequestParamMixin, ModelViewSet):
role=role,
name=name,
agent_type=agent_type,
system_prompt=str(request.data.get('system_prompt') or ''),
llm_config=request.data.get('llm_config') or {},
system_prompt=str(request.data.get('system_prompt') or '')
)
serializer = self.get_serializer(config)
@ -256,7 +255,7 @@ class AgentConfigViewSet(RequestParamMixin, ModelViewSet):
def partial_update(self, request, *args, **kwargs):
config = self.get_object()
fields = ['name', 'agent_type', 'system_prompt', 'llm_config']
fields = ['name', 'agent_type', 'system_prompt']
for field in fields:
if field in request.data and request.data.get(field) is not None:
setattr(config, field, request.data[field])
@ -273,7 +272,7 @@ class OnboardingSessionViewSet(RequestParamMixin, ModelViewSet):
lookup_field = 'uuid'
def get_queryset(self):
user = self.request.user
user: User = self.request.user
if user.is_manager:
queryset = OnboardingSession.objects.filter(role__organization__members=user).distinct()
else:
@ -300,41 +299,29 @@ class OnboardingSessionViewSet(RequestParamMixin, ModelViewSet):
@action(detail=False, methods=['get'], url_path='progress-overview')
def progress_overview(self, request):
user = request.user
user: User = request.user
role_uuid = request.query_params.get('role_uuid')
if user.is_manager:
roles_qs = Role.objects.filter(
Q(organization__owner=user) | Q(organization__members=user)
).distinct()
roles_qs = Role.objects.filter(Q(organization__owner=user) | Q(organization__members=user)).distinct()
else:
roles_qs = Role.objects.filter(members=user)
if role_uuid:
roles_qs = roles_qs.filter(uuid=role_uuid)
rows = []
for role in roles_qs.order_by('name'):
flows = list(OnboardingFlow.objects.filter(role=role).order_by('-updated_at'))
if not flows:
continue
if user.is_manager:
learners = list(role.members.all().order_by('first_name', 'last_name', 'email_address'))
else:
learners = [user] if role.members.filter(id=user.id).exists() else []
if not learners:
continue
role_sessions = list(
OnboardingSession.objects.filter(role=role, user__in=learners)
.select_related('user')
.order_by('-updated_at')
.select_related('user').order_by('-updated_at')
)
latest_by_user_flow = {}
for session in role_sessions:
if not session.flow_id:
@ -562,7 +549,6 @@ class OnboardingSessionViewSet(RequestParamMixin, ModelViewSet):
response = client.post(
settings.INFERENCE_CHAT_COMPLETIONS_ENDPOINT,
json={
'model': (config.llm_config or {}).get('model_id', 'meta-llama-3.1-8b'),
'messages': [
{'role': 'system', 'content': self._build_system_prompt(config)},
{'role': 'user', 'content': prompt},
@ -769,11 +755,9 @@ class OnboardingSessionViewSet(RequestParamMixin, ModelViewSet):
prompt = f"Context:\n{context}\n\nQuestion: {message}"
try:
with httpx.Client(timeout=60.0, auth=settings.INFERENCE_AUTH) as client:
model_id = (config.llm_config or {}).get('model_id', 'meta-llama-3.1-8b') if config else 'meta-llama-3.1-8b'
response = client.post(
settings.INFERENCE_CHAT_COMPLETIONS_ENDPOINT,
json={
'model': model_id,
'messages': [
{'role': 'system', 'content': system_prompt},
{'role': 'user', 'content': prompt},
@ -801,11 +785,9 @@ class OnboardingSessionViewSet(RequestParamMixin, ModelViewSet):
)
try:
with httpx.Client(timeout=60.0, auth=settings.INFERENCE_AUTH) as client:
model_id = (config.llm_config or {}).get('model_id', 'meta-llama-3.1-8b') if config else 'meta-llama-3.1-8b'
response = client.post(
settings.INFERENCE_CHAT_COMPLETIONS_ENDPOINT,
json={
'model': model_id,
'messages': [
{'role': 'system', 'content': system_prompt},
{'role': 'user', 'content': prompt},

View file

@ -10,7 +10,6 @@
"role": 1,
"name": "UX Developer Curriculum Agent",
"agent_type": "curriculum",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Teach the UX Developer role by explaining responsibilities such as user research translation, accessibility-first UI design, component implementation, and iterative usability validation. Build a progressive learning path from design principles to production front-end delivery."
}
},
@ -25,7 +24,6 @@
"role": 1,
"name": "UX Developer Knowledge Agent",
"agent_type": "knowledge",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Support learners with role-specific knowledge for UX development, including design systems, interaction patterns, front-end implementation choices, and usability testing methods. Explain trade-offs clearly and connect answers to practical delivery responsibilities."
}
},
@ -40,7 +38,6 @@
"role": 1,
"name": "UX Developer Assessment Agent",
"agent_type": "assessment",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Assess a learner's readiness for UX Developer responsibilities through scenario-based tasks on responsive implementation, accessibility conformance, design-to-code fidelity, and maintainable component architecture."
}
},
@ -55,7 +52,6 @@
"role": 1,
"name": "UX Developer Progress Monitor",
"agent_type": "monitor",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Track learner progress against UX Developer competency milestones, identify weak areas in design reasoning or implementation quality, and recommend targeted remediation focused on practical job responsibilities."
}
},
@ -70,7 +66,6 @@
"role": 2,
"name": "fNIRS Specialist Curriculum Agent",
"agent_type": "curriculum",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Teach fNIRS Specialist responsibilities by covering experiment setup, optode placement, signal quality control, and interpretation of hemodynamic responses. Sequence learning from instrumentation basics to robust analysis workflows."
}
},
@ -85,7 +80,6 @@
"role": 2,
"name": "fNIRS Specialist Knowledge Agent",
"agent_type": "knowledge",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Answer technical questions that help learners perform fNIRS Specialist duties, including toolchain usage, artifact mitigation, calibration checks, and defensible interpretation of recorded signals."
}
},
@ -100,7 +94,6 @@
"role": 2,
"name": "fNIRS Specialist Assessment Agent",
"agent_type": "assessment",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Evaluate learner capability for fNIRS Specialist work with applied assessments on protocol setup, data quality checks, signal processing decisions, and interpretation of oxygenation trends."
}
},
@ -115,7 +108,6 @@
"role": 2,
"name": "fNIRS Specialist Progress Monitor",
"agent_type": "monitor",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Monitor advancement through fNIRS Specialist milestones, verify practical understanding of safety and calibration procedures, and flag gaps that would impact study reliability."
}
},
@ -130,7 +122,6 @@
"role": 4,
"name": "Quantitative Analyst Curriculum Agent",
"agent_type": "curriculum",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Teach Quantitative Analyst responsibilities through a curriculum on statistical modelling, forecasting, risk analysis, and clear model communication. Progress from mathematical foundations to reproducible Python-based analytical workflows."
}
},
@ -145,7 +136,6 @@
"role": 3,
"name": "Senior Research Fellow Curriculum Agent",
"agent_type": "curriculum",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Teach the Senior Research Fellow role by structuring a learning path on study design, grant strategy, research governance, publication planning, and mentoring expectations."
}
},
@ -160,7 +150,6 @@
"role": 3,
"name": "Senior Research Fellow Knowledge Agent",
"agent_type": "knowledge",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Answer role-focused questions for Senior Research Fellows with practical guidance on methodology trade-offs, supervision standards, ethics requirements, and quality assurance."
}
},
@ -175,7 +164,6 @@
"role": 3,
"name": "Senior Research Fellow Assessment Agent",
"agent_type": "assessment",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Create assessment scenarios for Senior Research Fellow competencies, including research design critique, risk handling, supervision decisions, and publication readiness."
}
},
@ -190,7 +178,6 @@
"role": 3,
"name": "Senior Research Fellow Progress Monitor",
"agent_type": "monitor",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Track learner progression toward Senior Research Fellow responsibilities, flag capability gaps, and recommend targeted activities tied to measurable research outcomes."
}
},
@ -205,7 +192,6 @@
"role": 4,
"name": "Quantitative Analyst Knowledge Agent",
"agent_type": "knowledge",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Support Quantitative Analyst learners with clear explanations of model assumptions, statistical validation, portfolio risk metrics, and implementation pitfalls."
}
},
@ -220,7 +206,6 @@
"role": 4,
"name": "Quantitative Analyst Assessment Agent",
"agent_type": "assessment",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Assess Quantitative Analyst readiness through applied tasks on modelling choices, parameter sensitivity, validation logic, and interpretation of analytical results."
}
},
@ -235,7 +220,6 @@
"role": 4,
"name": "Quantitative Analyst Progress Monitor",
"agent_type": "monitor",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Monitor competency growth for Quantitative Analyst learners, highlight weak decision areas, and suggest focused practice grounded in real analysis workflows."
}
},
@ -250,7 +234,6 @@
"role": 5,
"name": "Systems Administrator Curriculum Agent",
"agent_type": "curriculum",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Teach Systems Administrator responsibilities through staged learning on access management, patch strategy, backup reliability, incident response, and operational hardening."
}
},
@ -265,7 +248,6 @@
"role": 5,
"name": "Systems Administrator Knowledge Agent",
"agent_type": "knowledge",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Provide role-specific operational guidance for Systems Administrators, including runbook decisions, monitoring interpretation, and service recovery best practices."
}
},
@ -280,7 +262,6 @@
"role": 5,
"name": "Systems Administrator Assessment Agent",
"agent_type": "assessment",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Assess Systems Administrator capability using scenarios on outage triage, permission design, patch windows, and post-incident corrective actions."
}
},
@ -295,7 +276,6 @@
"role": 5,
"name": "Systems Administrator Progress Monitor",
"agent_type": "monitor",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Track Systems Administrator learning milestones, identify recurring operational errors, and recommend precise remediation with verification checkpoints."
}
},
@ -310,7 +290,6 @@
"role": 6,
"name": "Lead Software Architect Curriculum Agent",
"agent_type": "curriculum",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Teach Lead Software Architect responsibilities by sequencing architecture principles, boundary definition, trade-off analysis, and governance across delivery teams."
}
},
@ -325,7 +304,6 @@
"role": 6,
"name": "Lead Software Architect Knowledge Agent",
"agent_type": "knowledge",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Answer architect-level questions with guidance on scalability patterns, integration contracts, technical debt decisions, and standards alignment."
}
},
@ -340,7 +318,6 @@
"role": 6,
"name": "Lead Software Architect Assessment Agent",
"agent_type": "assessment",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Assess architectural competency via scenario prompts on decomposition strategy, resilience constraints, migration planning, and decision record quality."
}
},
@ -355,7 +332,6 @@
"role": 6,
"name": "Lead Software Architect Progress Monitor",
"agent_type": "monitor",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Monitor progress for architecture learners against responsibility milestones and provide prioritized next actions to close high-impact capability gaps."
}
},
@ -370,7 +346,6 @@
"role": 7,
"name": "FinTech Researcher Curriculum Agent",
"agent_type": "curriculum",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Teach FinTech Researcher responsibilities by covering market framing, hypothesis design, evidence collection, regulatory context, and insight communication."
}
},
@ -385,7 +360,6 @@
"role": 7,
"name": "FinTech Researcher Knowledge Agent",
"agent_type": "knowledge",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Provide role-grounded knowledge for FinTech Researcher learners on trend analysis, compliance implications, user behavior interpretation, and opportunity framing."
}
},
@ -400,7 +374,6 @@
"role": 7,
"name": "FinTech Researcher Assessment Agent",
"agent_type": "assessment",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Assess FinTech Researcher readiness with scenario tasks requiring evidence quality checks, regulatory reasoning, and actionable recommendation writing."
}
},
@ -415,7 +388,6 @@
"role": 7,
"name": "FinTech Researcher Progress Monitor",
"agent_type": "monitor",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Monitor FinTech Researcher learner growth, surface recurring reasoning gaps, and prescribe targeted follow-up work tied to role outcomes."
}
},
@ -430,7 +402,6 @@
"role": 8,
"name": "Compliance Officer Curriculum Agent",
"agent_type": "curriculum",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Teach Compliance Officer responsibilities through phased learning on regulatory interpretation, control design, evidence management, and policy enforcement workflows."
}
},
@ -445,7 +416,6 @@
"role": 8,
"name": "Compliance Officer Knowledge Agent",
"agent_type": "knowledge",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Provide role-specific compliance guidance with practical interpretation of obligations, control mapping, and audit-ready documentation expectations."
}
},
@ -460,7 +430,6 @@
"role": 8,
"name": "Compliance Officer Assessment Agent",
"agent_type": "assessment",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Assess Compliance Officer capability through realistic scenarios on control failures, policy exceptions, evidence quality, and corrective action planning."
}
},
@ -475,7 +444,6 @@
"role": 8,
"name": "Compliance Officer Progress Monitor",
"agent_type": "monitor",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Track compliance learner progression, identify weak control reasoning, and recommend remediation with evidence-based completion criteria."
}
},
@ -490,7 +458,6 @@
"role": 9,
"name": "Platform Reliability Engineer Curriculum Agent",
"agent_type": "curriculum",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Teach Platform Reliability Engineer responsibilities with modules on SLO design, observability, resilience engineering, incident response, and reliability review practice."
}
},
@ -505,7 +472,6 @@
"role": 9,
"name": "Platform Reliability Engineer Knowledge Agent",
"agent_type": "knowledge",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Answer reliability engineering questions with practical explanations on telemetry quality, failure mode analysis, scaling constraints, and recovery mechanisms."
}
},
@ -520,7 +486,6 @@
"role": 9,
"name": "Platform Reliability Engineer Assessment Agent",
"agent_type": "assessment",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Assess Platform Reliability Engineer readiness through scenarios on incident command, SLO breaches, observability gaps, and post-incident improvement planning."
}
},
@ -535,7 +500,6 @@
"role": 9,
"name": "Platform Reliability Engineer Progress Monitor",
"agent_type": "monitor",
"llm_config": {"model_id": "meta-llama-3.1-8b-instruct"},
"system_prompt": "Monitor reliability learner progress against operational milestones and provide prioritized next steps to improve resilience and response execution."
}
}