Post-process the response from the agent.
(
self, response: str, history: list[Turn], turn: Turn, similar: int = 0
)
| 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 | |
| 442 | def get_simple_modelname(llms: list[LLM]): |
no test coverage detected