|
6 | 6 | 
|
7 | 7 | [](https://opensource.org/licenses/MIT)
|
8 | 8 |
|
| 9 | + |
| 10 | +<a href="https://colab.research.google.com/github/WecoAI/weco-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> |
| 11 | +<a target="_blank" href="https://lightning.ai/new?repo_url=https%3A%2F%2Fgithub.com%2FWecoAI%2Fweco-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> |
| 12 | + |
9 | 13 | # $f$(👷♂️)
|
10 | 14 |
|
11 | 15 | ## IMPORTANT
|
12 | 16 |
|
13 | 17 | This package has been deprecated. Please move to our new package - [aifn](https://github.com/WecoAI/aifn-python)!
|
14 | 18 |
|
15 |
| -<a href="https://colab.research.google.com/github/WecoAI/weco-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> |
16 |
| -<a target="_blank" href="https://lightning.ai/new?repo_url=https%3A%2F%2Fgithub.com%2FWecoAI%2Fweco-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> |
| 19 | +### From `weco` to `aifn` |
| 20 | + |
| 21 | +When migrating, here's what you need to know: |
| 22 | + |
| 23 | +#### Package |
| 24 | +- **`weco`**: Install using |
| 25 | + ```bash |
| 26 | + pip install weco |
| 27 | + ``` |
| 28 | +- **`aifn`**: Install using |
| 29 | + ```bash |
| 30 | + pip install aifn |
| 31 | + ``` |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +#### Building AI Functions |
| 36 | +- **`weco`**: Use the `build` method to create a function: |
| 37 | + ```python |
| 38 | + from weco import build |
| 39 | + function_name: str, function_version: int, function_description: str = build("identify objects in an image") |
| 40 | + ``` |
| 41 | +- **`aifn`**: Use the `build` method to create a function with type `AIFunction`: |
| 42 | + ```python |
| 43 | + from aifn import build |
| 44 | + object_identifier: AIFunction = build("identify objects in an image") |
| 45 | + ``` |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +#### Calling AI Functions |
| 50 | +- **`weco`**: Query an AI function using the `query` method: |
| 51 | + ```python |
| 52 | + from weco import query |
| 53 | + response = query( |
| 54 | + fn_name="BusinessIdeaAnalyzer-XYZ123", |
| 55 | + text_input="A subscription service for personalized, AI-generated bedtime stories for children." |
| 56 | + ) |
| 57 | + output = response["output"] |
| 58 | + ``` |
| 59 | +- **`aifn`**: Query an AI function by creating an `AIFunction` object: |
| 60 | + ```python |
| 61 | + from aifn import AIFunction |
| 62 | + idea_analyzer = AIFunction("BusinessIdeaAnalyzer-XYZ123") |
| 63 | + output = idea_analyzer("A subscription service for personalized, AI-generated bedtime stories for children.").output |
17 | 64 |
|
18 | 65 | A client facing API for interacting with the [Weco AI](https://www.weco.ai/) function builder [service](https://www.aifunction.com)!
|
19 | 66 |
|
|
0 commit comments