Skip to main content

A Python library for cataloging and searching python files.

Project description

SumPAI

Summarization and embedding of Python projects.

Generates information that is useful for helping machines understand your Python code.

The data structure looks like this:

{ "type": source_type, "name": name, "path": path, "hash": city_hash, "summary": summary, "embedding": embedding, }

Each file is broken into Classes, Class Functions, Functions and global level code.

Each of these are summarized using GPT-3.5-turbo and ada-02 embeddings are generated with the summary and code chunks.

Additionally, each file is summarized by all of the summaries above to give a complete overview of the file.

This project currently consumes about $0.02 for one run to give you an idea of the cost to run this.

If files were not changed it skips the file.

It will also skip classes and functions and globals if they were not changed.

It is intended for the files to be commited to the git repo and not for use by humans, it might make sense to hide these files in the future.

If you're not sure why you might need to run this you probably don't.

If you have a large project be aware that this code will scale models based on token count, for very large projects this might mean you will use gpt-4-32k.

Installation

pip install sum-pai

Usage

Setup your OpenAI API Key as the OPENAI_API_KEY environmental variable.

.env files are supported.

or pass with

--openai-api-key=<key>

sum_pai <target>

you can also set the logging level with LOG_LEVEL envvar or

--log-level=DEBUG

Searching

There's a search embedding in the root of the project, will be used for testing.

search_project.exe --text "perform a knn search" --target src

Result:

SS

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

sum_pai-0.4.0.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

sum_pai-0.4.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file sum_pai-0.4.0.tar.gz.

File metadata

  • Download URL: sum_pai-0.4.0.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for sum_pai-0.4.0.tar.gz
Algorithm Hash digest
SHA256 fae23b33e0f71521312c47518dbc063a9fa6091c2ff25643f594cf5dc1749f75
MD5 4fe40db79bb29196267116d52c707e9a
BLAKE2b-256 1e1ff76f96805b497efd80fafd6b25c2a6cd97620ba490a61b1d648c4fee6a15

See more details on using hashes here.

File details

Details for the file sum_pai-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: sum_pai-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for sum_pai-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d272a5ab54303aef92572b4068eaa77ba389bd2b0b6eefc52d4125f574cf7f8
MD5 6871e270432e38b6a93869bad4de21d6
BLAKE2b-256 f7b1c3b777a79fed0f3b60eb0d4d289ab1647a4a3d8b0c6b9bcedf9af81ba207

See more details on using hashes here.

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