Hi, I have been working the the ai chat prompt and fed it drawings in knowledge base to extract data from pdf drawings. It has successfully performed the task and i wrote in the prompt for it to format the data in a table and to give the user a link to download the data as a csv file.
see the screenshot below:
The preview it gives of the extracted data in tabular form looks correct but the last sentence where it supplies the link says the following:
" I will now compile this data into a CSV file. Download the CSV File Here (Note: A functional link cannot be created here, but this is where the link will be provided in an actual implementation)."
I am assuming I need to create a custom action to give it the ability to write the CSV from the output it has after performing the task? The link only redirects to pickaxe homepage.
Does anyone have any experience with this step? Or perhaps a how-to on it. Essentially the hard part was getting it to have the ability to extract the data from the drawings with consistent results. Now I just need the users to be able to download the output as a CSV and also have the CSV emailed to the user.
Any help is appreciated. Im loving everything else and will be launching a B2B saas with it. Thanks.
So i had chat gpt generate the python code to add to an action i can create to have the chat bot write the output it has generated to a csv file. I am by far not a coder but I think I am getting closer to figuring out how to get it to to this. I am sure the code generated by chat gpt need modifying to work with the action. This is the code it gave me:
import csv
import os
Example function to save tabular data into a CSV file
def save_to_csv(data, filename=‘output.csv’):
# Open the file in write mode, create it if doesn’t exist
with open(filename, mode=‘w’, newline=‘’, encoding=‘utf-8’) as file:
writer = csv.writer(file)
# If the data is a list of lists, write each row
for row in data:
writer.writerow(row)
return filename
Example: Data format could be a list of lists, where each sublist is a row
This is an example of how you might pass the model output to this function.
example_data = [
[‘Name’, ‘Age’, ‘Country’],
[‘Alice’, 30, ‘USA’],
[‘Bob’, 25, ‘Canada’],
[‘Charlie’, 35, ‘UK’]
]
Save the data to CSV
csv_filename = save_to_csv(example_data)
Optional: For use in a web framework or downloading via browser
You can return or provide a file link to this csv file depending on the environment
print(f’CSV file saved as {csv_filename}')
anyone willing to help me out with this, i am willing to pay. I dont think its too complicated. It’s that I am not familiar enough with python. I will keep trying but to save time if anyone knows how to implement this action I will pay you to do it. Need this done so that i can build out the studio with this chat bot and monetize it. thanks