MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / __post_process__

Method __post_process__

utils/src/llms.py:425–439  ·  view source on GitHub ↗

Post-process the response from the agent.

(
        self, response: str, history: list[Turn], turn: Turn, similar: int = 0
    )

Source from the content-addressed store, hash-verified

423 return self.__post_process__(response, history, turn, similar)
424
425 def __post_process__(
426 self, response: str, history: list[Turn], turn: Turn, similar: int = 0
427 ):
428 """
429 Post-process the response from the agent.
430 """
431 self.history.append(turn)
432 if similar > 0:
433 turn.embedding = get_text_embedding(turn.prompt, self.text_model)
434 if self.record_cost:
435 turn.calc_token()
436 self.calc_cost(history + [turn])
437 if self.return_json:
438 response = get_json_from_response(response)
439 return response
440
441
442def get_simple_modelname(llms: list[LLM]):

Callers 2

retryMethod · 0.95
__call__Method · 0.95

Calls 4

calc_costMethod · 0.95
get_text_embeddingFunction · 0.90
get_json_from_responseFunction · 0.90
calc_tokenMethod · 0.45

Tested by

no test coverage detected