Provider-specific Swarmauri import package for fal.ai queue-backed vision-language inference, OCR, image captioning, and visual question answering.
Project description
Swarmauri fal.ai Vision Model
swarmauri_llm_falai provides the provider-specific FalAIVisionModel
import for Swarmauri projects that call fal.ai vision and image-understanding
models. The adapter accepts an image URL plus a prompt, submits the request to
fal's queue-backed inference API, polls for completion, and returns the model
output string.
This package preserves the legacy LLM-package import path for fal.ai vision
workloads while keeping implementation parity with
swarmauri_standard.llms.FalAIVisionModel. New VLM-oriented code should also
review the newer Swarmauri VLM imports mentioned by the runtime deprecation
warning.
fal.ai's public documentation describes queue-backed inference under
https://queue.fal.run/{model_id}, including request submission, status polling,
and response retrieval. That maps directly to this adapter's predict and
apredict workflows.
Why Use This Package?
- Keep fal.ai-specific vision model dependencies isolated from the rest of a Swarmauri application.
- Ask questions about remote images with Swarmauri-style model components.
- Use fal's queue-backed inference lifecycle without writing queue polling logic in application code.
- Preserve compatibility for projects that still import
FalAIVisionModelfrom the LLM provider package.
FAQ
What does swarmauri_llm_falai install?
It installs a provider package that exports FalAIVisionModel from
swarmauri_standard.llms.FalAIVisionModel and registers it under the Swarmauri
LLM entry point group.
Is this a text-only LLM package?
No. The model accepts image_url and prompt arguments and is intended for
vision-language tasks such as OCR, image captioning, visual question answering,
and image moderation workflows supported by fal.ai models.
Which fal.ai endpoint does it use?
The adapter posts to https://queue.fal.run/{model_id}. When fal returns a
request_id, the adapter polls the corresponding request status endpoint until
the request is completed, then fetches the response URL.
Which environment variable can supply credentials?
The model default reads FAL_KEY when api_key is not passed explicitly. The
package tests also support live checks when a fal.ai key is available.
Does this adapter support streaming?
No. stream and astream intentionally raise NotImplementedError for
FalAIVisionModel.
Features
- Provider-specific
FalAIVisionModelimport for Swarmauri projects. - Vision-language prediction with
image_urlandpromptinputs. - Queue-backed request submission and status polling through fal.ai.
- Synchronous prediction through
predict. - Asynchronous prediction through
apredict. - Configurable queue polling with
max_retriesandretry_delay. - Built-in model allow list covering OCR, LLaVA, Florence, Moondream, MiniCPM, SA2VA, and related fal.ai vision endpoints.
- Compatibility with Python 3.10, 3.11, 3.12, 3.13, and 3.14.
Installation
uv add swarmauri_llm_falai
pip install swarmauri_llm_falai
Prerequisites
Create a fal.ai API key and provide it as FalAIVisionModel(api_key=...) or set
FAL_KEY in the runtime environment.
Usage
from swarmauri_llm_falai import FalAIVisionModel
model = FalAIVisionModel(api_key="FAL_KEY")
answer = model.predict(
image_url="https://llava-vl.github.io/static/images/monalisa.jpg",
prompt="Who painted this artwork?",
)
print(answer)
Async Vision Question Answering
import asyncio
from swarmauri_llm_falai import FalAIVisionModel
async def main() -> None:
model = FalAIVisionModel(api_key="FAL_KEY")
answer = await model.apredict(
image_url="https://llava-vl.github.io/static/images/monalisa.jpg",
prompt="Describe the subject of the painting.",
)
print(answer)
asyncio.run(main())
Choose A fal.ai Vision Model
from swarmauri_llm_falai import FalAIVisionModel
model = FalAIVisionModel(api_key="FAL_KEY", name="fal-ai/florence-2-large/ocr")
text = model.predict(
image_url="https://example.com/document-scan.png",
prompt="Extract the visible text.",
)
print(text)
Related Packages
- swarmauri_llm_deepinfra
- swarmauri_llm_gemini
- swarmauri_llm_openai
- swarmauri_llm_pytesseractimg2text
- swarmauri_llm_whisper
Foundational Swarmauri Packages
Provider Documentation
Best Practices
- Store fal.ai credentials in environment variables or a secrets manager.
- Use image URLs that are reachable by the fal.ai runtime.
- Tune
max_retriesandretry_delayfor long-running queue-backed models. - Prefer newer Swarmauri VLM imports for new projects when available.
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_llm_falai-0.11.0.dev1.tar.gz.
File metadata
- Download URL: swarmauri_llm_falai-0.11.0.dev1.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f8128b0d8cf0008a1af8fd0ec4d287a46d2ac89ddbb667fbb128429d618253
|
|
| MD5 |
e34882b44c5ac60ab81f3823a948042b
|
|
| BLAKE2b-256 |
01b096ce0be318408e71ec091cdb6c63c0f73104d9e6316081be6b7e599398c7
|
File details
Details for the file swarmauri_llm_falai-0.11.0.dev1-py3-none-any.whl.
File metadata
- Download URL: swarmauri_llm_falai-0.11.0.dev1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
533cad95f97672760cd617ec60e03b3ee16c59e8582fe65fc9282a2b9a446e74
|
|
| MD5 |
a6a5f9769a9e66e001a8465c10906add
|
|
| BLAKE2b-256 |
b76eac7bdf5eaa0c10f45f4966061d9d4c2d5995465dd8d47450cfb5db230e33
|