create_xorbits_agentfrom langchain.llms import OpenAIarr = np.array([1, 2, 3, 4, 5, 6])agent = create_xorbits_agent(OpenAI(temperature=0), arr, verbose=True)      0%|          |   0.00/100 [00:00<?, ?it/s]agent.run("Give the shape of the array ")            > Entering new  chain...    Thought: I need to find out the shape of the array    Action: python_repl_ast    Action Input: data.shape    Observation: (6,)    Thought: I now know the final answer    Final Answer: The shape of the array is (6,).        > Finished chain.    'The shape of the array is (6,).'agent.run("Give the 2nd element of the array ")            > Entering new  chain...    Thought: I need to access the 2nd element of the array    Action: python_repl_ast    Action Input: data[1]      0%|          |   0.00/100 [00:00<?, ?it/s]        Observation: 2    Thought: I now know the final answer    Final Answer: 2        > Finished chain.    '2'agent.run(    "Reshape the array into a 2-dimensional array with 2 rows and 3 columns, and then transpose it")            > Entering new  chain...    Thought: I need to reshape the array and then transpose it    Action: python_repl_ast    Action Input: np.reshape(data, (2,3)).T      0%|          |   0.00/100 [00:00<?, ?it/s]        Observation: [[1 4]     [2 5]     [3 6]]    Thought: I now know the final answer    Final Answer: The reshaped and transposed array is [[1 4], [2 5], [3 6]].        > Finished chain.    'The reshaped and transposed array is [[1 4], [2 5], [3 6]].'agent.run(    "Reshape the array into a 2-dimensional array with 3 rows and 2 columns and sum the array along the first axis")            > Entering new  chain...    Thought: I need to reshape the array and then sum it    Action: python_repl_ast    Action Input: np.sum(np.reshape(data, (3,2)), axis=0)      0%|          |   0.00/100 [00:00<?, ?it/s]        Observation: [ 9 12]    Thought: I now know the final answer    Final Answer: The sum of the array along the first axis is [9, 12].        >
This notebook shows how to use agents to interact with Xorbits Pandas dataframe and Xorbits Numpy ndarray. It is mostly optimized for question answering.
This notebook shows how to use agents to interact with Xorbits Pandas dataframe and Xorbits Numpy ndarray. It is mostly optimized for question answering. ->: create_xorbits_agentfrom langchain.llms import OpenAIarr = np.array([1, 2, 3, 4, 5, 6])agent = create_xorbits_agent(OpenAI(temperature=0), arr, verbose=True)      0%|          |   0.00/100 [00:00<?, ?it/s]agent.run("Give the shape of the array ")            > Entering new  chain...    Thought: I need to find out the shape of the array    Action: python_repl_ast    Action Input: data.shape    Observation: (6,)    Thought: I now know the final answer    Final Answer: The shape of the array is (6,).        > Finished chain.    'The shape of the array is (6,).'agent.run("Give the 2nd element of the array ")            > Entering new  chain...    Thought: I need to access the 2nd element of the array    Action: python_repl_ast    Action Input: data[1]      0%|          |   0.00/100 [00:00<?, ?it/s]        Observation: 2    Thought: I now know the final answer    Final Answer: 2        > Finished chain.    '2'agent.run(    "Reshape the array into a 2-dimensional array with 2 rows and 3 columns, and then transpose it")            > Entering new  chain...    Thought: I need to reshape the array and then transpose it    Action: python_repl_ast    Action Input: np.reshape(data, (2,3)).T      0%|          |   0.00/100 [00:00<?, ?it/s]        Observation: [[1 4]     [2 5]     [3 6]]    Thought: I now know the final answer    Final Answer: The reshaped and transposed array is [[1 4], [2 5], [3 6]].        > Finished chain.    'The reshaped and transposed array is [[1 4], [2 5], [3 6]].'agent.run(    "Reshape the array into a 2-dimensional array with 3 rows and 2 columns and sum the array along the first axis")            > Entering new  chain...    Thought: I need to reshape the array and then sum it    Action: python_repl_ast    Action Input: np.sum(np.reshape(data, (3,2)), axis=0)      0%|          |   0.00/100 [00:00<?, ?it/s]        Observation: [ 9 12]    Thought: I now know the final answer    Final Answer: The sum of the array along the first axis is [9, 12].        >