MCPcopy
hub / github.com/TaskingAI/TaskingAI / inference

Method inference

backend/app/services/assistant/generation/session.py:377–395  ·  view source on GitHub ↗

Perform chat completion inference :return: a tuple of assistant message dict, function calls dict, usage dict, and completion data dict

(self)

Source from the content-addressed store, hash-verified

375 yield tool_action_result_log_dict
376
377 async def inference(self) -> Tuple[Dict, List, Dict, Dict]:
378 """
379 Perform chat completion inference
380 :return: a tuple of assistant message dict, function calls dict, usage dict, and completion data dict
381 """
382
383 completion_data = await chat_completion(
384 model=self.model,
385 messages=self.chat_completion_messages,
386 functions=self.chat_completion_functions,
387 configs={},
388 )
389
390 assistant_message_dict = completion_data["message"]
391 function_calls = assistant_message_dict.get("function_calls")
392 usage = completion_data.get("usage")
393 self.total_input_tokens += usage.get("input_tokens", 0)
394 self.total_output_tokens += usage.get("output_tokens", 0)
395 return assistant_message_dict, function_calls, usage, completion_data
396
397 async def stream_inference(self, message_chunk_object_name="MessageChunk"):
398 try:

Callers 4

stream_generateMethod · 0.80
stream_generateMethod · 0.80
generateMethod · 0.80
generateMethod · 0.80

Calls 2

chat_completionFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected