Skip to content

Consume LLM output stream via returned objects to allow caching #752

Consume LLM output stream via returned objects to allow caching

Consume LLM output stream via returned objects to allow caching #752

Workflow file for this run

name: Test
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
# Options to test specific APIs ignoring the VCR cassettes
anthropic:
description: "Test using Anthropic API"
type: boolean
default: false
litellm_anthropic:
description: "Test using Anthropic API via LiteLLM"
type: boolean
default: false
litellm_openai:
description: "Test using OpenAI API via LiteLLM"
type: boolean
default: false
mistral:
description: "Test using Mistral API"
type: boolean
default: false
openai:
description: "Test using OpenAI API"
type: boolean
default: false
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Set up uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies
run: uv sync
- run: uv run ruff check --output-format=github .
- run: uv run ruff format --check .
- run: uv run mypy .
- run: uv run pytest -vv tests/
# Do not use `github.event.inputs` because it converts booleans to strings
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
- if: inputs.anthropic
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: uv run pytest -vv tests/ -m 'anthropic' --record-mode=rewrite
- if: inputs.litellm_anthropic
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: uv run pytest -vv tests/ -m 'litellm_anthropic' --record-mode=rewrite
- if: inputs.litellm_openai
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_ORG_ID: ${{ secrets.OPENAI_ORG_ID }}
run: uv run pytest -vv tests/ -m 'litellm_openai' --record-mode=rewrite
- if: inputs.mistral
env:
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
run: uv run pytest -vv tests/ -m 'mistral' --record-mode=rewrite
- if: inputs.openai
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_ORG_ID: ${{ secrets.OPENAI_ORG_ID }}
run: uv run pytest -vv tests/ -m 'openai' --record-mode=rewrite