facebookresearch / labgraph

LabGraph is a Python framework for rapidly prototyping experimental systems for real-time streaming applications. It is particularly well-suited to real-time neuroscience, physiology and psychology experiments.
MIT License
162 stars 47 forks source link

Labgraph pilot #103

Open maitnngo2002 opened 1 year ago

maitnngo2002 commented 1 year ago

Description

This feature is data generation for training purposes. Scrape API keywords from several predefined urls and pass these keywords to OpenAI API to get the generated code for that each keyword.

The generated code blocks will be saved to a local file. Just specify the directory you want to save the results, and you can go that place to look at the generated code blocks.

Because using OpenAI API requires a API_key, we store it in a .env file (make sure to have .env package installed by pip install dotenv).

Fixes #97

Link to the full list of keywords: https://github.com/maitnngo2002/labgraph/blob/labgraph-pilot/keyword.txt

Feature/Issue validation/testing

To validate if the code works, you can follow these steps:

  1. To test if we have successfully extract the keywords, open the keyword_generation.py file, create a constant for KeywordGeneration class and run the extract_keywords function, you could look at the output in the terminal and a list of expected keywords will be printed. For example, initiate the instance as test = KeywordGeneration() and run test.extract_keywords(), we should see the output in the terminal as shown below:

image

  1. i) To test if the configuration to access the OpenAI API has been successful, open the decription_to_code.py file, create a constant for DescriptionToCode class and run the get_code_from_description function with an arbitrary API keyword as a parameter. For example, initiate the instance as test = DescriptionToCode() and run `test.get_code_from_description('scipy.signal.convolve'), we should get back the expected code block in the terminal as shown below:

image

ii) To generate the code blocks for every single API keyword and save it a local file, run test.get_code() and open the 'output.txt' file to see the result as shown below: image

image

facebook-github-bot commented 1 year ago

Hi @maitnngo2002!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

facebook-github-bot commented 1 year ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

jfResearchEng commented 1 year ago

Consider including the full list of generated names.

maitnngo2002 commented 1 year ago

Done. Added the txt file and cited the link in the description (https://github.com/maitnngo2002/labgraph/blob/labgraph-pilot/keyword.txt)