NumpyAISession¶
- class numpyai.NumpyAISession(data: List[ndarray | array])¶
Bases:
objectSession to handle chatting with multiple arrays.
- Parameters:
data – List[numpy.ndarray] The data of the array class.
- MAX_TRIES = 3¶
- assert_is_code(llm_response: str) str¶
Ensure LLM response is valid Python/NumPy code.
- chat(query: str) Any¶
Handles user queries by generating and executing NumPy code with retries.
- execute_numpy_code(code: str, code_out=None) Any¶
Executes generated NumPy code within the session’s context.
- generate_numpy_code(query: str, context: Dict) str¶
Generate valid NumPy code from the query.
- validate_output(query: str, output: Any, error=None) bool¶
Validates the output of a NumPy operation.