Team Ai
Apppublic

openenv/coding_env

sourceHugging Faceupdated 3mo agoView on Hugging Face
21likes
coding_env_client.cpython-313.pyc45 linesDownload Raw Back to __pycache__
1�

2���hb���SrSSKJr SSKJrJr SSKJr SSKJ	r	 SSK3JrJrJ
r
 \(aSSKJr "S	S4\\\45rg)a�5CodingEnv6---------7Client-side wrapper for the Coding environment server.8Talks HTTP to a single base_url exposing: /reset and /step.9 10- users instantiate CodingEnv with a base_url provided by the higher-level11  vector/orchestration layer.12- Environment authors ship the Docker image that serves the HTTP API.13 14(Seeds, episode IDs, request IDs, capabilities can be added later in the payloads.)15�)�annotations)�
TYPE_CHECKING�Optional)�
HTTPEnvClient)�16StepResult�)�17CodeAction�CodeObservation�	CodeState)�ContainerProviderc�2�\rSrSrSSjrSSjrS	SjrSrg)18�	CodingEnv�c��SUR0$)N�code)r)�self�actions  �J/Users/zwentz/Development/OpenEnv/src/envs/coding_env/coding_env_client.py�
_step_payload�CodingEnv._step_payloads��
�F�K�K�19�	20�c21��[S0USD6n[UURS5[URSS55S9$)N�observation�reward�doneF)rrr�)r22r�get�bool)r�payload�obss   r�
_parse_result�CodingEnv._parse_result$sC���7��
� 6�7�����;�;�x�(��g�k�k�&�%�0�1�23�	24rc�v�[URS5URSS5URSS5S9$)z�25Parse server response into CodeState object.26 27Args:28    payload: JSON response from /state endpoint29 30Returns:31    CodeState object with episode_id, step_count, and last_exit_code32�33episode_id�34step_countr�last_exit_code)r$r%r&)rr)rrs  r�_parse_state�CodingEnv._parse_state-s:����{�{�<�0��{�{�<��3�"�;�;�'7��;�35�	36rrN)rr	�return�dict)rr*r)zStepResult[CodeObservation])rr*r)r)�__name__�37__module__�__qualname__�__firstlineno__rr!r'�__static_attributes__rrrrrs��38�39�40rrN)�__doc__�41__future__r�typingrr�core.http_env_clientr�42core.typesr�modelsr	r43r�core.containers.runtimerrrrr�<module>r7s:���#�*�.�!�:�:��9� 44�
�j�/�9�:� 45r