Skip to main content
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 their 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!

Metadata

Release files for aifn 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aifn 0.2.2
File Size Uploaded
aifn-0.2.2.tar.gz 35.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for aifn 0.2.2
File Interpreter ABI Platform
aifn-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 MB

Release files / aifn-0.2.2.tar.gz

Download URL aifn-0.2.2.tar.gz
Size 35.2 MB
Tags Source
SHA-256 checksum
How to use checksums
280bcd4aadca417ed36aefd6ae0c06756d4c271d483420b20d88e332ac48f20a
BLAKE2b-256 checksum
How to use checksums
ef327595a0ec39618fee7d28bf6deecdecae0f7a3a8af47a0280a7eb77e6cc3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 19, 2024.

Transparency log

Release files / aifn-0.2.2-py3-none-any.whl

Download URL aifn-0.2.2-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d45b8cb0dabf1faa9bac2b0e4480a1d67aed3299b7882d17696665fd45cc8c2
BLAKE2b-256 checksum
How to use checksums
24f9af697a172183cb2d51e7977fac0ea250dd833c86ad2b4d5c9cca2e8ca969
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 19, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page