aifn


Nameaifn JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryDocumentation for `aifn`, a client facing API for interacting with the WecoAI's AI functions.
upload_time2024-11-25 18:15:21
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords ai llm vlm ai functions prompt engineering nlp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center" style="display: flex; align-items: center; justify-content: center;">
  <picture>
    <source srcset="docs/assets/ai_function_light.png" media="(prefers-color-scheme: dark)">
    <img src="docs/assets/ai_function_dark.png" alt="AI Function" style="max-width: 100%;">
  </picture>
</div>

#

![Python](https://img.shields.io/badge/Python-3.10.14-blue)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
<a href="https://colab.research.google.com/github/WecoAI/aifn-python/blob/main/examples/cookbook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" width=110 height=20/></a>
<a target="_blank" href="https://lightning.ai/new?repo_url=https%3A%2F%2Fgithub.com%2FWecoAI%2Faifn-python%2Fblob%2Fmain%2Fexamples%2Fcookbook.ipynb"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open in Studio" width=100 height=20/></a>

A client facing API for interacting with the [Weco AI](https://www.weco.ai/)'s AI function [platform](https://www.aifunction.com). It empowers you to go from zero to AI in just a few seconds!

Use this API to build *complex* AI features *fast*. We lower the barrier of entry to AI features by providing an interface to prototype solutions quickly, in just a few lines of code and in natural language.

## What We Offer

- Structured Output (outputs are Python dictionaries that **always** follow your AI functions JSON schema)
- Multimodal (language & vision)
- Grounding (Access to the web)
- Interpretable (observe reasoning behind outputs)
- Batched Inputs (have inputs be processed in concurrently)
- Sync-Async Duality (functions can be both synchronous & asynchronous)

## Getting Started

Install the `aifn` package:
```bash
pip install aifn
```

When using the Weco API, you will need to set the API key: You can find/create your API key [here](https://www.aifunction.com/account/api-keys). Once you have your API key, you can pass it directly to our core functions and classes using the `api_key` argument or set it as an environment variable as shown:
```bash
export WECO_API_KEY=<YOUR_WECO_API_KEY>
```

### Example

We created a function on our [platform](https://www.aifunction.com) for the following task:
> "Analyze a business idea and provide a well reasoned evaluation. Return 'viability_score' (0-100), 'strengths' (list), 'weaknesses' (list), and 'next_steps' (list)."

Here's how you can use this function anywhere in your code!
```python
from aifn import AIFunction
idea_evaluator = AIFunction("BusinessIdeaAnalyzer-XYZ123") # Replace with your actual function name
response = idea_evaluator("A subscription service for personalized, AI-generated bedtime stories for children.").output
```

- The `aifn.build` function enables quick and easy prototyping of new AI functions that use foundation models as thier core. We encourage users to do this through our [platform](https://www.aifunction.com) for maximum control and ease of use, however, you can also do this through our API as shown [here](examples/cookbook.ipynb).
- `aifn.AIFunction` allows you to retrieve an AI function you've already created.
- Finally, as shown in the example above, `AIFunction` objects are akin to any function that we are used to...the only difference is that they have a large language model to power them!

To learn how to get the most your of **your** AI functions, check out our [cookbook](examples/cookbook.ipynb).

## Contributing

We value your contributions! If you believe you can help to improve our package enabling people to build AI with AI, please contribute!

Use the following steps as a guideline to help you make contributions:

1. Download and install package from source:
   ```bash
   git clone https://github.com/WecoAI/aifn-python.git
   cd aifn-python
   pip install -e ".[dev,docs]"
   ```

2. Create a new branch for your feature or bugfix:
   ```bash
   git checkout -b feature/your-feature-name
   ```

3. Make your changes and run tests to ensure everything is working:
   
   > **Tests can be expensive to run as they make LLM requests with the API key being used so it is the developers best interests to write small and simple tests that adds coverage for a large portion of the package.**
   
   ```bash
   pytest -n auto tests
   ```
   If you're just making changes to the docs, feel free to skip this step.

4. Commit and push your changes, then open a PR for us to view 😁

Please ensure your code follows our style guidelines (Numpy docstrings) and includes appropriate tests. We appreciate your contributions!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aifn",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "AI, LLM, VLM, AI functions, Prompt Engineering, NLP",
    "author": null,
    "author_email": "Weco AI Team <dhruv@weco.ai>",
    "download_url": "https://files.pythonhosted.org/packages/0e/7a/a9825d62236dc004add67c4aeea3813d8bc16a0b142c2bfab7c87b1eb4be/aifn-0.2.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\" style=\"display: flex; align-items: center; justify-content: center;\">\n  <picture>\n    <source srcset=\"docs/assets/ai_function_light.png\" media=\"(prefers-color-scheme: dark)\">\n    <img src=\"docs/assets/ai_function_dark.png\" alt=\"AI Function\" style=\"max-width: 100%;\">\n  </picture>\n</div>\n\n#\n\n![Python](https://img.shields.io/badge/Python-3.10.14-blue)\n[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n<a href=\"https://colab.research.google.com/github/WecoAI/aifn-python/blob/main/examples/cookbook.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\" width=110 height=20/></a>\n<a target=\"_blank\" href=\"https://lightning.ai/new?repo_url=https%3A%2F%2Fgithub.com%2FWecoAI%2Faifn-python%2Fblob%2Fmain%2Fexamples%2Fcookbook.ipynb\"><img src=\"https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg\" alt=\"Open in Studio\" width=100 height=20/></a>\n\nA client facing API for interacting with the [Weco AI](https://www.weco.ai/)'s AI function [platform](https://www.aifunction.com). It empowers you to go from zero to AI in just a few seconds!\n\nUse this API to build *complex* AI features *fast*. We lower the barrier of entry to AI features by providing an interface to prototype solutions quickly, in just a few lines of code and in natural language.\n\n## What We Offer\n\n- Structured Output (outputs are Python dictionaries that **always** follow your AI functions JSON schema)\n- Multimodal (language & vision)\n- Grounding (Access to the web)\n- Interpretable (observe reasoning behind outputs)\n- Batched Inputs (have inputs be processed in concurrently)\n- Sync-Async Duality (functions can be both synchronous & asynchronous)\n\n## Getting Started\n\nInstall the `aifn` package:\n```bash\npip install aifn\n```\n\nWhen using the Weco API, you will need to set the API key: You can find/create your API key [here](https://www.aifunction.com/account/api-keys). Once you have your API key, you can pass it directly to our core functions and classes using the `api_key` argument or set it as an environment variable as shown:\n```bash\nexport WECO_API_KEY=<YOUR_WECO_API_KEY>\n```\n\n### Example\n\nWe created a function on our [platform](https://www.aifunction.com) for the following task:\n> \"Analyze a business idea and provide a well reasoned evaluation. Return 'viability_score' (0-100), 'strengths' (list), 'weaknesses' (list), and 'next_steps' (list).\"\n\nHere's how you can use this function anywhere in your code!\n```python\nfrom aifn import AIFunction\nidea_evaluator = AIFunction(\"BusinessIdeaAnalyzer-XYZ123\") # Replace with your actual function name\nresponse = idea_evaluator(\"A subscription service for personalized, AI-generated bedtime stories for children.\").output\n```\n\n- The `aifn.build` function enables quick and easy prototyping of new AI functions that use foundation models as thier core. We encourage users to do this through our [platform](https://www.aifunction.com) for maximum control and ease of use, however, you can also do this through our API as shown [here](examples/cookbook.ipynb).\n- `aifn.AIFunction` allows you to retrieve an AI function you've already created.\n- Finally, as shown in the example above, `AIFunction` objects are akin to any function that we are used to...the only difference is that they have a large language model to power them!\n\nTo learn how to get the most your of **your** AI functions, check out our [cookbook](examples/cookbook.ipynb).\n\n## Contributing\n\nWe value your contributions! If you believe you can help to improve our package enabling people to build AI with AI, please contribute!\n\nUse the following steps as a guideline to help you make contributions:\n\n1. Download and install package from source:\n   ```bash\n   git clone https://github.com/WecoAI/aifn-python.git\n   cd aifn-python\n   pip install -e \".[dev,docs]\"\n   ```\n\n2. Create a new branch for your feature or bugfix:\n   ```bash\n   git checkout -b feature/your-feature-name\n   ```\n\n3. Make your changes and run tests to ensure everything is working:\n   \n   > **Tests can be expensive to run as they make LLM requests with the API key being used so it is the developers best interests to write small and simple tests that adds coverage for a large portion of the package.**\n   \n   ```bash\n   pytest -n auto tests\n   ```\n   If you're just making changes to the docs, feel free to skip this step.\n\n4. Commit and push your changes, then open a PR for us to view \ud83d\ude01\n\nPlease ensure your code follows our style guidelines (Numpy docstrings) and includes appropriate tests. We appreciate your contributions!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Documentation for `aifn`, a client facing API for interacting with the WecoAI's AI functions.",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/WecoAI/aifn-python"
    },
    "split_keywords": [
        "ai",
        " llm",
        " vlm",
        " ai functions",
        " prompt engineering",
        " nlp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8919dc53ae51125d8e26b602ae8692b394555aa2e04c1c2afd77ce3ecae79257",
                "md5": "9cc7fe0d9e998dbfdba501af28f409eb",
                "sha256": "56171644d34caed85f846fc7986723e7b6fdceb66199a7ab59c4e2556ef0b5cc"
            },
            "downloads": -1,
            "filename": "aifn-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9cc7fe0d9e998dbfdba501af28f409eb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 15181,
            "upload_time": "2024-11-25T18:15:19",
            "upload_time_iso_8601": "2024-11-25T18:15:19.561179Z",
            "url": "https://files.pythonhosted.org/packages/89/19/dc53ae51125d8e26b602ae8692b394555aa2e04c1c2afd77ce3ecae79257/aifn-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e7aa9825d62236dc004add67c4aeea3813d8bc16a0b142c2bfab7c87b1eb4be",
                "md5": "2429592bff4e72eb1ebc3ca20b5ba065",
                "sha256": "186661e5221679b59a8158a2415320dda3ac3a35358cd57d7e4ead36b5fb4ddb"
            },
            "downloads": -1,
            "filename": "aifn-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2429592bff4e72eb1ebc3ca20b5ba065",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 185008,
            "upload_time": "2024-11-25T18:15:21",
            "upload_time_iso_8601": "2024-11-25T18:15:21.645663Z",
            "url": "https://files.pythonhosted.org/packages/0e/7a/a9825d62236dc004add67c4aeea3813d8bc16a0b142c2bfab7c87b1eb4be/aifn-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-25 18:15:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "WecoAI",
    "github_project": "aifn-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aifn"
}
        
Elapsed time: 0.56595s