Skip to main content

Documentation for `aifn`, a client facing API for interacting with the WecoAI's AI functions.

Project description

AI Function

Python License Open In Colab Open in Studio

A client facing API for interacting with the Weco AI's AI function platform. 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:

pip install aifn

When using the Weco API, you will need to set the API key: You can find/create your API key here. 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:

export WECO_API_KEY=<YOUR_WECO_API_KEY>

Example

We created a function on our platform 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!

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 for maximum control and ease of use, however, you can also do this through our API as shown here.
  • 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.

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:

    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:

    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.

    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!

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

aifn-0.2.0.tar.gz (184.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aifn-0.2.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file aifn-0.2.0.tar.gz.

File metadata

  • Download URL: aifn-0.2.0.tar.gz
  • Upload date:
  • Size: 184.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for aifn-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c5f545beaa54452ba981073ef586064a1e27969726c73cf46d810e17f7080d4b
MD5 82530fceb46657343a5dce9fa6215a58
BLAKE2b-256 12fb1dec4a2c10061a1cbafc834b999d77912c832494221735721563f8dddd49

See more details on using hashes here.

Provenance

The following attestation bundles were made for aifn-0.2.0.tar.gz:

Publisher: release.yml on WecoAI/aifn-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aifn-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: aifn-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for aifn-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccbf91dd733c9565295297b0aeccdb5db19d8cc949eb3119c527bbfbe85a2661
MD5 3d68c80c52970001bb405184f8df2922
BLAKE2b-256 97c9b72c01821d29efc6430bb75a65ccc8b8d95f67924d770cbf1568748f77b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for aifn-0.2.0-py3-none-any.whl:

Publisher: release.yml on WecoAI/aifn-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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