# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['kork']

package_data = \
{'': ['*']}

install_requires = \
['langchain>=0.0.110',
 'lark>=1.1.5,<2.0.0',
 'openai>=0.27,<0.28',
 'sphinx-design>=0.4.1,<0.5.0']

setup_kwargs = {
    'name': 'kork',
    'version': '0.0.2',
    'description': 'Programming with LLMs',
    'long_description': '[![Unit Tests](https://github.com/langchain-ai/kork/actions/workflows/test.yml/badge.svg?branch=main&event=push)](https://github.com/langchain-ai/kork/actions/workflows/test.yml)\n\n# Kork ![alt The Parrot](assets/parrot.png)\n\n`Kork` is an *experimental* [Langchain chain](https://python.langchain.com/en/latest/modules/chains.html) that helps build natural language APIs powered by LLMs.\n\n## Features\n\n1. Assemble a natural language API from a set of python functions.\n2. Generate a prompt to help the LLM write a **correct** program.\n3. Execute the program generated by the LLM **safely**.\n4. Program generation takes a single LLM call, as opposed to agents that use a call per action taken.\n\n## How\n\nThe chain takes a user query, translates it into a program, and executes it using the `Kork` interpreter.\n\nThe interpreter is used to run code written in the `Kork` programming language.\n\nThe language is limited by design to variable declarations, function invocations and arithmetic operations.\n\nThis limitation allows controlling the kind of programs the LLMs can generate, making the output of the LLM more predictable and safer to execute in a production setting. (An agent with access to "constrained" tools has similar benefits, but requires a call per action taken.)\n\n`Kork` adds a few additional tricks (e.g., retriever interfaces for examples and foreign functions) to help guide the LLM to generate a **correct** program.\n\n## What?\n\n*No loops, no conditionals, no file access, no network access, no arbitrary code execution. WHAT?!*\n\nThe ability to invoke custom functions goes a long way in terms of the kinds of programs that can be written! (You can always add a `write_to_file` function!)\n\n\n## Limitations\n\n- `Kork` **cannot write arbitrary** code. If that\'s what you need, save yourself some time and use [docker](https://www.docker.com/) and a real programming language.\n- The `Kork` chain is **not** an Agent, so it cannot inspect intermediate steps, instead it generates a pre-defined set of function calls that need to be executed. (But remember that function calls can involve calls to an agent!)\n- The `Kork` language and interpreter are limited to *function invocation*, *variable declaration* and\n  *basic arithmetic* (no function declaration, loops etc.)\n- Only supporting `int`, `float`, `str`, `type(None)`, `bool` types. No support for `lists` or `object` types.\n- Very limited type annotations.\n\n## Quality\n\nThe short version: No benchmarks yet!\n\nThe long version: Quality of generated programs depends on many factors.\n\nYou can experiment with tweaking the prompt (e.g., explain the syntax of the language), changing the foreign function retriever (e.g., retrieve the most relevant foreign functions based on the user query), or providing examples in the form of (query, expected program).\n\nThe prompt, examples and syntax of the language can trip up the LLM to assume\nit\'s programming in a specific language (e.g., typescript or python) and assume\nthat it can use language features that are not supported by `Kork` or to import\nlibraries that are not available.\n\n## Safety\n\nNothing is bulletproof when humans are involved.\n\n* Don\'t do silly things like exposing `eval` as a foreign function.\n* If a foreign function allocates memory, the LLM could ask for more memory than is available crashing the process.\n* Think carefully before using the output of an LLM. If the LLM behaves maliciously, is it safe to use an LLM in the given context? \n\n## Future Work\n\nLet us know if you\'re interested in contributing or have ideas for improvements!\n\n- Allow enabling/disabling language features\n- Allow changing underlying language syntax\n- Add support for objects\n- Add other language features (e.g., loops) \n- Provide foreign function retriever implementations based on similarity to user query\n\n## Compatibility\n\n`Kork` is tested against python 3.8, 3.9, 3.10, 3.11.\n\n## Installation \n\n```sh\npip install kork\n```\n\n## 🙏 Appreciation\n\n* [Lark](https://github.com/lark-parser/lark) -- For making it easy to define a grammar and parse it!\n* [Bob Nystrom](https://github.com/munificent) -- For writing [Crafting Interpreters](https://www.craftinginterpreters.com/)!\n\n## © Contributing\n\nIf you have any ideas or feature requests, please open an issue and share!\n\nSee [CONTRIBUTING.md](https://github.com/langchain-ai/kork/blob/main/CONTRIBUTING.md) for more information.\n\n## 🎶 Why the name?\n\nFast to type and maybe sufficiently unique.\n',
    'author': 'LangChain',
    'author_email': 'None',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/langchain-ai/kork',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.8.1,<4.0.0',
}


setup(**setup_kwargs)
