Skip to main content

A simple Python library

Project description

😆Finae

Contact Ning Ren (renning22@gmail.com) for discussion, contribution or ☕.

(Draft)

Finae's vision is to build a AI-powered programming languange and greatly simplify programming.

For now, Finae can be used as a tool to more easily work with LLMs. With simple configurations, LLMs output turns into stable and easy-to-process Python objects.

The key idea is to exploit 🌲tree-of-thoughts and ✔️self-consistency of LLMs and find the stable outputs via heavy/concurrent queries against multiple LLMs.

Think about asking the same question in different words or from different angles. The answer will converge if an LLM really knows it (if the fact was well-spread in the training corpus).

This approach works better with multiple LLMs, given that each LLM is a unique representation of its training dataset. And it also works well with smaller models (~7B parameters) as it eliminates hallucinations.

See more 🪐vision and mission behind Finae.

Samples

Finae class is called concept.

@finae.Concept
class Mountain:
    ...

    @finae.Attribute
    def name(self):
        ...

    @finae.Attribute
    def location(self):
        ...

Concept Examples

Mountain

m = Mountain('give me any mountain in this world')
print(m.name())

m = Mountain('Highest mountain in the world')
print(m.altitude())

m = Mountain('Mount Everest')
print(m.altitude())

mountains = Mountain.query('Top 50 mountains in the wolrd')
for m in mountains:
    print(m.name())

Integer/Float

i = Integer('give me a code generate integer in python')
i = Integer('show me an example of Python integer')
i = Integer('show me an example of Python float')

Date

d = Date('independence day of United States')
print(d)

d = Date('1995/03/01')
print(d)

d = Date('03-01-1995')
print(d)

d = Date('year 1995, March, first')
print(d)

d = Date('the day after 1995/03/01')
print(d)

d = Date('the day after ', d)
print(d)

Array

a = Array('[1, 2, 3, 4]')
print(a)

a = Array('1, 2, 3, 4')
print(a)

a = Array('1 2 5 6 10')
print(a)

a = Array('1 to 4')
print(a)

a = Array('1 to 4, inclusive')
print(a)

a = Array('give me an array of integer, length less than 20')
print(a)

Numpy, pandas

n = Numpy('give me a numpy array, length 10')
print(n)

n = Numpy("""
1 2 3
4 5 6
7 8 9
""")
print(n)

t = PandasTable('Pandas table, columns: name, school, age')
print(t)

t = PandasTable("""
name school age
foo    A    y
bar    B    z
""")
print(t)

Finae concept memories samples it has processed

E.g. up to 100 for example, and ranked by some scores, keep LRU.

for m in Mountain.samples():
    print(m)

Finae concept memories/caches the way it parses the input.

The cache is local database file or py that can be checked-in to codebase and version-controlled. (Or delete if want to drop the cache.)

d = Date('independence day of United States')
d = Date('independence day of United States')  # read from cache
d = Date('independence day of United States')  # read from cache

Install

> pip install -e .

Owner/maintainer

Publish to pip hub

python3 -m pip install --upgrade build
python3 -m pip install --upgrade twine

rm dist/ -rf
python3 -m build
twine check dist/*
twine upload dist/*

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

finae-0.0.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

finae-0.0.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file finae-0.0.2.tar.gz.

File metadata

  • Download URL: finae-0.0.2.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.10

File hashes

Hashes for finae-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c9abd8980029329e6c185f355ddafbeb298bbb373e852192afc4a2ff35cfaf96
MD5 08d416bda633cf32584f5ebe21f0685a
BLAKE2b-256 e70f8722b90e92aecc1e15c8346a109440f78c98d0f9aacd9c4b2b69557c4d06

See more details on using hashes here.

File details

Details for the file finae-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: finae-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.10

File hashes

Hashes for finae-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ece9a618dfacdd9c4083e80e48bbf8c47a7ce4e1a446985fd5d13e3e1f26d399
MD5 e9ea132d386e879c448812268180c63e
BLAKE2b-256 1cf5ac3f60ec18adf450edd390d8412174072308abdfec27ad9f3f982826d741

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