Python: Code Interpreter returning NaNs when there is missing field #12598
Replies: 2 comments 2 replies
-
Hi @CristinaStn, Thank you for your question! Depending on your application, you may need to create a pipeline that post processes the agent's output to have 100% guaranteed on the final form of your table. There is another thing you can try in addition to the instruction message. You can augment the user request to the agent with additional requirement, i.e. the user message. This may be more effective than the instruction message if your context is long. However, this still won't guarantee the table will not have NaNs. |
Beta Was this translation helpful? Give feedback.
-
One other thought, @CristinaStn: when we handle the other issue you raised (#12552), by returning code as part of the intermediate message callback, that should give you a way to filter the chunks for |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Using Semantic Kernel AzureAssistantAgent with access to Code interpreter to provide comprehensive stats and data insights on some tabular data in .csv format.
For some analysis, the Agent is using Code Interpreter tool to answer. It provides a table with samples of data from input which may contain missing values (which is normal). The missing values are displayed to the end user as NaNs. For example:
We do understand these NaNs are coming by default from pandas library. However, an important business requirement for our integration is not to provide such NaNs cells to the end user. We tried to control this behaviour of the agent via instruction prompt:
When using the code interpreter tool, treat all NaN, null, or missing values the same way Microsoft Excel would treat empty cells — display them as empty strings. This ensures consistency and clarity for end-users who expect Excel-like behaviour.
But this solution does not always provide accurate and consistent answers to the end user: at some point during conversation with the agent, the agent shows NaNs when answering and when generates files with those reports.
Q: Do you have any recommendation to make the Agent to avoid NaNs while using code interpreter?
Note: we are using semantic kernel==1.29.0
Beta Was this translation helpful? Give feedback.
All reactions