Skip to content

asynchronous-flows/api-call-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Call Example

Built with asyncflows

main repo Discord

Introduction

This example demonstrates how to use and write custom asyncflows actions.

This repo includes:

  • my_actions/my_get_url.py, an action that fetches the HTML of a website
  • get_website_title.yaml, a flow that prompts a language model to get the title of the fetched website
  • get_website_title.py, a script that runs the flow

Running the Example

To run the example:

  1. Set up Ollama or configure another language model

  2. Clone the repository

git clone ssh://git@github.com/asynchronous-flows/api-call-example
  1. Change into the directory
cd api-call-example
  1. Create and activate your virtual environment (with, for example)
python3.11 -m venv .venv
source .venv/bin/activate
  1. If not already installed, install poetry. Install dependencies with:
poetry install
  1. Run the example
python -m api_call_example.get_website_title

Writing your own Actions

Use this repository as a template, and add more actions in the api_call_example/my_actions directory.

As long as they are in the my_actions directory, they will be automatically loaded by the asyncflows library. If you'd like to change that directory, or use the paradigm in the different package, simply include the tool.poetry.plugins directive in the pyproject.toml file:

[tool.poetry.plugins."asyncflows"]
actions = "api_call_example.my_actions"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages