Github Co-Pilot -- Part 2
Image by VectorPortal.com ( https://vectorportal.com/ )

Github Co-Pilot -- Part 2

This is a continuation to my earlier article

Scenario based code generation 3 - CSV file as a reference and mongodb as the destination, encrypt the sensitive data

In the earlier prompt, the ask was to read from a file and input into the mongodb. The file had a sensitive data which is the password, so I changed my prompt to include an encryption module using bcrypt. I identified the userPassword and requested the same to be encrypted before pushing into the database. I selected the entire earlier code base and then initiated the Co-Pilot with the prompt

  • Prompt : "userDataset.csv is a file having userName, userPassword and userRole. Generate a golang program to read the contents of this file and push the contents onto a local mongodb host, having a database called bot. The userPassword must be encrypted using bcrypt before loading into the database."
  • The interesting thing is the system gives me a diff between the old and the revised code base showing the changes, the first image shows the new libraries that have been put in place and the second image reflects how the bcrypt library is being put to use.

  • I accepted the changes and cleared the collection from mongodb. I ran the code using go run main.go
  • Here is the snapshot of the entries in the collection. They are all encrypted.

  • This is really getting interesting. I tried couple of variations in the prompt to see if there are any changes to the recommended code base.
  • I tried without mentioning bcrypt, the code generated was the same as bcrypt is the gold standard for encryption.
  • I also tried this "userDataset.csv is a file having userName, userPassword and userRole. Generate a golang program to read the contents of this file and push the contents onto a local mongodb host, having a database called bot. The sensitive data must be encrypted using bcrypt before loading into the database". I did not quote password for encryption but rather kept it open ended calling for any sensitive data to be encrypted. The resulting code generated was the same. That's cool, Co-Pilot analyses all the data and classifies the right one to be encrypted.

Scenario based code generation 4 - A wide CSV file as a reference and mongodb as the destination, a few data type conversions

  • This is not very different to the previous scenario but I wanted to explore if the Co-Pilot can read a csv file in my project directory and generate the code to load into my local mongodb database. This csv file curatedContent.csv is a wide file having more than 10 columns.
  • Well the Co-Pilot did not read the file. That would have been a great feature. I mean I thought I can skip giving the column names and that can be auto inferred from the CSV file.
  • So instead I changed my prompt
  • Prompt : "curatedContent.csv is a file having rowNumber,contentSubjectArea,contentSubjectAreaSubArea,learningContentId,learningStep,contentType,contentDescription,contentURL,smenotes,transcript,pycodeSnippet. Generate a golang program that reads the file curatedContent.csv and loads the same into mongodb database bot. Here rowNumber,learningContentId,learningStep are of type integer"
  • The integer conversions are in place as per the instructions

  • I ran the program and can see the mongodb collection all loaded in its entirety

As part of the next article I will explore more complex interactions with Co-Pilot, have it scan my existing code base. So far I have been trying to generate code that can load files into mongodb with a few changes here and there.

Happy learning and Keep experimenting. Share your experience with Github Co-Pilot. I would love to hear your experiences.

Anindita Desarkar, PhD

PhD in CSE (JU) || Product Owner || Gen AI Practitioner || Director @LTIMindtree|| Dedicated Researcher in Data Science, Gen AI || Mentor || Patents on AI/DS/Gen AI

1 年

Great one Vishwa! Just one thought. For the second experiment, we are passing the column names to the prompt as it's unable to read from input file. So, can we break it into two parts to make it dynamic? In the first part, just pass the excel to LLM and ask to provide the column names and in the second part, we will add that answer in the prompt.

要查看或添加评论,请登录

Vishwanathan Raman的更多文章

  • Generating Assessments using Gen AI -- Part 2

    Generating Assessments using Gen AI -- Part 2

    This is in continuation to the article https://www.linkedin.

    3 条评论
  • Generating Assessments using Gen AI

    Generating Assessments using Gen AI

    Assessment Generation has always been a task of a SME. It is a complex and time consuming task of both Development &…

    5 条评论
  • Flutter/Dart, Gemini API

    Flutter/Dart, Gemini API

    #ignAIte, #AI, #GenAI The past few weeks have been crazy, relearning a lost knowledge and then creating something fun…

    7 条评论
  • Github Co-Pilot -- Part 3

    Github Co-Pilot -- Part 3

    This is a continuation to my earlier article I am just starting from the place I left off. Its time for some complex…

    4 条评论
  • Github Co-Pilot -- Part 1

    Github Co-Pilot -- Part 1

    Co-Pilot is an interesting topic within the Gen AI landscape and one of the most widely adopted areas. A report by…

    2 条评论
  • Gen AI -- Quantised Models -- llama.cpp -- Long Weekend Project Part 3

    Gen AI -- Quantised Models -- llama.cpp -- Long Weekend Project Part 3

    Here are the links to the my earlier articles first article, second article on building a Gen AI solution on the…

    3 条评论
  • Gen AI -- Long Weekend Project Part 2

    Gen AI -- Long Weekend Project Part 2

    Here is the followup to my first article I remember the phrase "When the GOING gets tough the TOUGH gets going" and…

    2 条评论
  • Gen AI Weekend Project

    Gen AI Weekend Project

    The World Cup is on. The match against PAK on 14-Oct was anti-climax, maybe our Indian team was too good for the other…

    8 条评论
  • Lessons learnt using Golang and MongoDB

    Lessons learnt using Golang and MongoDB

    This past quarter I have been experimenting with Golang and this past week in particular, my downtime from work, I have…

  • Golang Quirkiness

    Golang Quirkiness

    Over last few days I have been fiddling with Golang and was quick to realize that it was not for faint heart…

社区洞察

其他会员也浏览了