Skip to main content

No project description provided

Project description

Wildered

wildered is a personal, over-engineered, toy project for autocompleting your Python code using OpenAI GPT-3.5.

Installation

You can install wildered with pip. You need to have Python version of 3.10 or above to use wildered.

pip install wildered

Basic usage

Suppose that you have two Python scripts:

test.py:

from pydantic import BaseModel
from models import Point

def find_y_intercept(point_1: Point, point_2: Point) -> Point:
    """
    Given two points, find and return the y intercept as Point object
    """
    pass

models.py:

from typing import Any, NamedTuple, TypeAlias
import numpy.typing as npt
import numpy as np

class Point(NamedTuple):
    x: int
    y: int
    
    def as_ndarray(self) -> npt.NDArray:
        return np.array([self.x, self.y])

We wish to implement find_y_intercept in test.py. However, we cannot just copy paste the whole script, as the function depends on the definition of Point object, which is in models.py.

Lets see what wildered can do.

First, we add directives to the test.py.

New test.py:

from pydantic import BaseModel
import wildered # You can choose not to import wildered if you want
from models import Point

@wildered.hint([Point])
@wildered.autocomplete()
def find_y_intercept(point_1: Point, point_2: Point) -> Point:
    """
    Given two points, find and return the y intercept as POint object
    """
    pass

Now we run the wildered cli command:

wildered test.py

wildered will format a prompt for you ready to be used for code completion LLM:

I am writing a Python project and I need your help as a code assistant.
Below are the functions or classes that I am working on:

```python
def find_y_intercept(point_1: Point, point_2: Point) -> Point:
    """
    Given two points, find and return the y intercept as POint object
    """
    pass
```

Below are the tasks you need to accomplish:
'''
## Task 1
Implement find_y_intercept function. Follow instruction from docstrings and comments on how to implement the function. Ensure that your answer has type annotations. 

'''
Below are snippets of code in the current project that you may find useful:
```python
from typing import Any, NamedTuple, TypeAlias
import numpy.typing as npt
import numpy as np

class Point(NamedTuple):
    x: int
    y: int

    def as_ndarray(self) -> npt.NDArray:
        return np.array([self.x, self.y])
```

Your answer should only have the functions or class that you are told to implement. Do not repeat other code in your answer

Note: Actual output may differ as prompt template changes over time.

A more detailed documentation is still under development. Meanwhile you can learn more by running wildered --help

Future works

  • Automatically detect dependencies instead of specifying all of them manually. Also detect the dependencies of the dependencies.
  • Improving automatic integration of the LLM response into your project code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wildered-0.2.4.tar.gz (22.7 kB view hashes)

Uploaded Source

Built Distribution

wildered-0.2.4-py3-none-any.whl (30.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page