(
app_name: str, eval_set_id: str, req: AddSessionToEvalSetRequest
)
| 841 | tags=[TAG_EVALUATION], |
| 842 | ) |
| 843 | async def add_session_to_eval_set( |
| 844 | app_name: str, eval_set_id: str, req: AddSessionToEvalSetRequest |
| 845 | ): |
| 846 | # Get the session |
| 847 | session = await self.session_service.get_session( |
| 848 | app_name=app_name, user_id=req.user_id, session_id=req.session_id |
| 849 | ) |
| 850 | assert session, "Session not found." |
| 851 | |
| 852 | # Convert the session data to eval invocations |
| 853 | invocations = evals.convert_session_to_eval_invocations(session) |
| 854 | |
| 855 | # Populate the session with initial session state. |
| 856 | agent_or_app = self.agent_loader.load_agent(app_name) |
| 857 | root_agent = self._get_root_agent(agent_or_app) |
| 858 | initial_session_state = create_empty_state(root_agent) |
| 859 | |
| 860 | new_eval_case = EvalCase( |
| 861 | eval_id=req.eval_id, |
| 862 | conversation=invocations, |
| 863 | session_input=SessionInput( |
| 864 | app_name=app_name, |
| 865 | user_id=req.user_id, |
| 866 | state=initial_session_state, |
| 867 | ), |
| 868 | creation_timestamp=time.time(), |
| 869 | ) |
| 870 | |
| 871 | try: |
| 872 | self.eval_sets_manager.add_eval_case( |
| 873 | app_name, eval_set_id, new_eval_case |
| 874 | ) |
| 875 | except ValueError as ve: |
| 876 | raise HTTPException(status_code=400, detail=str(ve)) from ve |
| 877 | |
| 878 | @app.get( |
| 879 | "/dev/apps/{app_name}/eval_sets/{eval_set_id}/evals", |
nothing calls this directly
no test coverage detected