@@ -94,7 +94,8 @@ def map_message_role(role: IrisMessageRole) -> str:
94
94
class ExerciseChatAgentPipeline (Pipeline ):
95
95
"""Exercise chat agent pipeline that answers exercises related questions from students."""
96
96
97
- llm : IrisLangchainChatModel
97
+ llm_big : IrisLangchainChatModel
98
+ llm_small : IrisLangchainChatModel
98
99
pipeline : Runnable
99
100
callback : ExerciseChatStatusCallback
100
101
suggestion_pipeline : InteractionSuggestionPipeline
@@ -112,14 +113,22 @@ def __init__(
112
113
super ().__init__ (implementation_id = "exercise_chat_pipeline" )
113
114
# Set the langchain chat model
114
115
completion_args = CompletionArguments (temperature = 0.5 , max_tokens = 2000 )
115
- self .llm = IrisLangchainChatModel (
116
+ self .llm_big = IrisLangchainChatModel (
116
117
request_handler = CapabilityRequestHandler (
117
118
requirements = RequirementList (
118
119
gpt_version_equivalent = 4.5 ,
119
120
),
120
121
),
121
122
completion_args = completion_args ,
122
123
)
124
+ self .llm_small = IrisLangchainChatModel (
125
+ request_handler = CapabilityRequestHandler (
126
+ requirements = RequirementList (
127
+ gpt_version_equivalent = 4.25 ,
128
+ ),
129
+ ),
130
+ completion_args = completion_args ,
131
+ )
123
132
self .variant = variant
124
133
self .event = event
125
134
self .callback = callback
@@ -130,15 +139,15 @@ def __init__(
130
139
self .retriever = LectureRetrieval (self .db .client )
131
140
self .reranker_pipeline = RerankerPipeline ()
132
141
self .code_feedback_pipeline = CodeFeedbackPipeline ()
133
- self .pipeline = self .llm | JsonOutputParser ()
142
+ self .pipeline = self .llm_big | JsonOutputParser ()
134
143
self .citation_pipeline = CitationPipeline ()
135
144
self .tokens = []
136
145
137
146
def __repr__ (self ):
138
- return f"{ self .__class__ .__name__ } (llm ={ self .llm } )"
147
+ return f"{ self .__class__ .__name__ } (llm_big ={ self .llm_big } , llm_small= { self . llm_small } )"
139
148
140
149
def __str__ (self ):
141
- return f"{ self .__class__ .__name__ } (llm ={ self .llm } )"
150
+ return f"{ self .__class__ .__name__ } (llm_big ={ self .llm_big } , llm_small= { self . llm_small } )"
142
151
143
152
@traceable (name = "Exercise Chat Agent Pipeline" )
144
153
def __call__ (self , dto : ExerciseChatPipelineExecutionDTO ):
@@ -504,15 +513,14 @@ def lecture_content_retrieval() -> str:
504
513
tool_list .append (lecture_content_retrieval )
505
514
tools = generate_structured_tools_from_functions (tool_list )
506
515
agent = create_tool_calling_agent (
507
- llm = self .llm , tools = tools , prompt = self .prompt
516
+ llm = self .llm_big , tools = tools , prompt = self .prompt
508
517
)
509
518
agent_executor = AgentExecutor (agent = agent , tools = tools , verbose = False )
510
519
self .callback .in_progress ()
511
520
out = None
512
521
for step in agent_executor .iter (params ):
513
- print ("STEP:" , step )
514
522
self ._append_tokens (
515
- self .llm .tokens , PipelineEnum .IRIS_CHAT_EXERCISE_AGENT_MESSAGE
523
+ self .llm_big .tokens , PipelineEnum .IRIS_CHAT_EXERCISE_AGENT_MESSAGE
516
524
)
517
525
if step .get ("output" , None ):
518
526
out = step ["output" ]
@@ -525,13 +533,13 @@ def lecture_content_retrieval() -> str:
525
533
]
526
534
)
527
535
528
- guide_response = (self .prompt | self .llm | StrOutputParser ()).invoke (
536
+ guide_response = (self .prompt | self .llm_small | StrOutputParser ()).invoke (
529
537
{
530
538
"response" : out ,
531
539
}
532
540
)
533
541
self ._append_tokens (
534
- self .llm .tokens , PipelineEnum .IRIS_CHAT_EXERCISE_AGENT_MESSAGE
542
+ self .llm_small .tokens , PipelineEnum .IRIS_CHAT_EXERCISE_AGENT_MESSAGE
535
543
)
536
544
if "!ok!" in guide_response :
537
545
print ("Response is ok and not rewritten!!!" )
0 commit comments