Let’s talk

JS Code Generator

  • #Work Productivity

The client’s goal was to develop a solution that would generate and test JS code using OpenAi’s GPT-3.5 model. The model should be able to get results from Google and Stack Overflow to improve the generation quality.

  • Machine Learning

Impact

The solution quickly generates and tests simple functions, that save time for employees and improve their productivity.

Services we provided

A solution to generate and test JavaScript functions using online resources, improving code quality
and productivity.

Tech Stack

Python

Django

LangChain

Docker

Challenges and Solutions

🧐 Challenges

  • Connecting the LLM to Google and Stack Overflow
  • Dynamically testing the generated code

💡 Solutions

To connect the model to the internet it was decided to use a ReAct Agent and provide it with tools necessary to connect to Google and Stack Overflow. The Google tool is natively available in LangChain, but the Stack Overflow tool had to be developed separately. The pipeline for processing the user’s request is as follows:

  • The user’s request is passed to the Agent
  • The agent decides which tools to use, if any to generate the JS code formatted as a function within a module
  • The code is running within a VM and the function is executed with test arguments

User flow

1. The user inputs the description of the function that they want to generate, and provide test arguments to verify the generated code’s correctness.
2. The agent searches the internet if necessary and generates the function
3. The code gets run in a VM with the test arguments, and if the program works, the code is returned to the user

This website uses cookies

We use cookies to personalize content and advertising, provide social networking features, and analyze our traffic. We also share information about your use of our website with our social media, advertising and analytics partners, who may combine it with other information you have provided to them or collected from your use of their services. You agree to our cookies if you continue to use our website.

Okay, I understand