### Start and Verify Floom Service Source: https://context7.com/floomai/floom/llms.txt Use `docker compose up -d` to start the services defined in your docker-compose.yml file. After startup, you can verify that Floom Core is running by sending a health check request to its API endpoint. ```bash # Start the full stack docker compose up -d # Verify Floom is running curl http://localhost:4050/v1/misc/health # "Healthy" ``` -------------------------------- ### LangChain Prompt Python Script Source: https://context7.com/floomai/floom/llms.txt Example `prompt.py` for a Floom function, defining a LangChain chain. This script must expose a `chain` variable. ```python from langchain.prompts import PromptTemplate from langchain.chat_models import ChatOpenAI from langchain.schema.runnable import RunnableSequence llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0) prompt = PromptTemplate.from_template( "Summarize the following article in 3 bullet points in {language}:\n\n{input}" ) ``` -------------------------------- ### Get Function Details by Name Source: https://context7.com/floomai/floom/llms.txt Fetch detailed information about a specific public function using its normalized name. Handles both successful retrieval and 'not found' scenarios. ```bash curl -X GET http://localhost:4050/v1/functions/summarize-article ``` ```json # Response (200 OK): # { # "name": "summarize-article", # "description": { "en": "Summarizes a news article into 3 bullet points" }, # "runtimeLanguage": "python", # "runtimeFramework": "langchain", # "rating": 0.0, # "downloads": [], # "parameters": [ ... ] # } # Not found (404): # { "message": "Function summarize-article not found" } ``` -------------------------------- ### Get Function by Name Source: https://context7.com/floomai/floom/llms.txt Retrieves details for a single public function by its normalized name. ```APIDOC ## GET /v1/functions/{name} ### Description Retrieves details for a single public function by its normalized name. ### Method GET ### Endpoint /v1/functions/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The normalized name of the function. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET http://localhost:4050/v1/functions/summarize-article ``` ### Response #### Success Response (200 OK) - A function object containing details about the specified function. #### Response Example ```json { "name": "summarize-article", "description": { "en": "Summarizes a news article into 3 bullet points" }, "runtimeLanguage": "python", "runtimeFramework": "langchain", "rating": 0.0, "downloads": [], "parameters": [ ... ] } ``` #### Error Response (404 Not Found) - **message** (string) - Error message indicating the function was not found. #### Error Response Example ```json { "message": "Function summarize-article not found" } ``` ``` -------------------------------- ### Python Runtime for LangChain Runnable Source: https://context7.com/floomai/floom/llms.txt This Python code defines a LangChain runnable that can be deployed as a Floom function. The `chain` variable is the required entry point. Ensure necessary LangChain and OpenAI libraries are installed. ```python # Example prompt.py deployed as a Floom function from langchain.prompts import ChatPromptTemplate from langchain.chat_models import ChatOpenAI from langchain_core.output_parsers import StrOutputParser llm = ChatOpenAI(model="gpt-3.5-turbo") prompt = ChatPromptTemplate.from_messages([ ("system", "You are a professional email writer."), ("human", "Write a professional email about: {input}. Tone: {tone}.") ]) # 'chain' is the required entry point — must be a LangChain Runnable chain = prompt | llm | StrOutputParser() ``` -------------------------------- ### Run a Function Source: https://context7.com/floomai/floom/llms.txt Executes a deployed function by name, passing a prompt and optional key-value parameters. The server fetches the function code and executes it. ```APIDOC ## POST /v1/functions/run ### Description Executes a deployed function by name, passing a prompt and optional key-value parameters. The server fetches the function code and executes it. ### Method POST ### Endpoint /v1/functions/run ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **function** (string) - Required - The name of the function to run. - **prompt** (string) - Required - The input prompt for the function. - **parameters** (object) - Optional - Key-value pairs for additional parameters. ### Request Example ```bash curl -X POST http://localhost:4050/v1/functions/run \ -H "Content-Type: application/json" \ -d { "function": "summarize-article", "prompt": "OpenAI has released GPT-5 with new reasoning capabilities...", "parameters": { "language": "Spanish" } } ``` ### Response #### Success Response (200 OK) - Raw output from the executed LangChain chain. #### Response Example ```text "• OpenAI lanzó GPT-5 con nuevas capacidades de razonamiento.\n• ..." ``` ``` -------------------------------- ### Register Guest User Source: https://context7.com/floomai/floom/llms.txt Creates an anonymous guest account to obtain an API key for immediate use without an OAuth flow. The response includes the generated apiKey, username, and nickname. ```bash curl -X POST http://localhost:4050/v1/account/registerguest \ -H "Content-Type: application/json" ``` -------------------------------- ### Register a Guest User Source: https://context7.com/floomai/floom/llms.txt Creates an anonymous guest account and returns an API key for immediate use without an OAuth flow. ```APIDOC ## POST /v1/account/registerguest ### Description Creates an anonymous guest account and returns an API key that can be used immediately without any OAuth flow. ### Method POST ### Endpoint /v1/account/registerguest ### Request Body This endpoint does not require a request body. ### Response #### Success Response (200 OK) - **apiKey** (string) - The API key for the newly created guest user. - **username** (string) - The username of the guest user. - **nickname** (string) - The nickname of the guest user. ### Request Example ```bash curl -X POST http://localhost:4050/v1/account/registerguest \ -H "Content-Type: application/json" ``` ### Response Example ```json { "apiKey": "floom_abc123xyz...", "username": "quick-otter-7412", "nickname": "CoolOtter" } ``` ``` -------------------------------- ### List All Deployed Functions Source: https://context7.com/floomai/floom/llms.txt Retrieve a list of all functions owned by the authenticated user. This endpoint returns metadata for each deployed function. ```bash curl -X GET http://localhost:4050/v1/functions/list \ -H "Api-Key: floom_abc123xyz..." ``` ```json # Response (200 OK): # [ # { # "name": "summarize-article", # "description": { "en": "Summarizes a news article into 3 bullet points" }, # "runtimeLanguage": "python", # "runtimeFramework": "langchain", # "author": "CoolOtter", # "version": "", # "rating": 0.0, # "downloads": [], # "parameters": [ # { "name": "language", "description": { "en": "Target language" }, "required": false, "defaultValue": "English" } # ] # } # ] ``` -------------------------------- ### Deploy a Function Source: https://context7.com/floomai/floom/llms.txt Deploys a ZIP archive containing a LangChain prompt and manifest to Floom's function registry. ```APIDOC ## POST /v1/functions/deploy ### Description Deploys a ZIP archive containing a LangChain `prompt.py` and a `manifest.yml` to Floom's function registry. The ZIP is extracted, `prompt.py` and optionally `data.py` are uploaded to S3 (`FLOOM_S3_FUNCTIONS_BUCKET`), and metadata is stored in MongoDB. ### Method POST ### Endpoint /v1/functions/deploy ### Headers - **Api-Key** (string) - Required - The API key for authentication. ### Parameters #### Form Data - **file** (file) - Required - The ZIP archive containing the function files. - **manifest** (json) - Required - The function manifest details. ### ZIP Archive Structure: ``` my-function.zip ├── manifest.yml # required ├── prompt.py # required — must expose a LangChain `chain` variable └── data.py # optional — data preprocessing module ``` ### manifest.yml Example: ```yaml manifest: name: summarize-article description: "Summarizes a news article into 3 bullet points" runtime: language: python framework: langchain entrypoint: prompt: prompt.py parameters: - name: language description: "Target language for the summary" required: false defaultValue: "English" ``` ### prompt.py Example: ```python from langchain.prompts import PromptTemplate from langchain.chat_models import ChatOpenAI from langchain.schema.runnable import RunnableSequence llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0) prompt = PromptTemplate.from_template( "Summarize the following article in 3 bullet points in {language}:\n\n{input}" ) ``` ### Request Example ```bash curl -X POST http://localhost:4050/v1/functions/deploy \ -H "Api-Key: floom_abc123xyz..." \ -F "file=@my-function.zip" ``` ``` -------------------------------- ### List My Functions Source: https://context7.com/floomai/floom/llms.txt Returns all functions owned by the authenticated user. ```APIDOC ## GET /v1/functions/list ### Description Returns all functions owned by the authenticated user. ### Method GET ### Endpoint /v1/functions/list ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET http://localhost:4050/v1/functions/list \ -H "Api-Key: floom_abc123xyz..." ``` ### Response #### Success Response (200 OK) - An array of function objects, each containing details like name, description, runtime, author, etc. #### Response Example ```json [ { "name": "summarize-article", "description": { "en": "Summarizes a news article into 3 bullet points" }, "runtimeLanguage": "python", "runtimeFramework": "langchain", "author": "CoolOtter", "version": "", "rating": 0.0, "downloads": [], "parameters": [ { "name": "language", "description": { "en": "Target language" }, "required": false, "defaultValue": "English" } ] } ] ``` ``` -------------------------------- ### Deploy a Function with Floom AI Source: https://context7.com/floomai/floom/llms.txt Package your Python function and its dependencies into a zip file and deploy it using the Floom AI API. Ensure your function is a LangChain Runnable and includes a manifest.yml. ```bash zip my-function.zip manifest.yml prompt.py curl -X POST http://localhost:4050/v1/functions/deploy \ -H "Api-Key: floom_abc123xyz..." \ -F "file=@my-function.zip" ``` ```json { "message": "Function summarize-article deployed successfully" } ``` -------------------------------- ### Search Public Functions Source: https://context7.com/floomai/floom/llms.txt Perform a full-text search across the public function registry. Queries must be at least 5 characters long and match against name, title, and description. ```bash curl -X POST http://localhost:4050/v1/functions/search \ -H "Content-Type: application/json" \ -d '{ "query": "translate" }' ``` ```json # Response (200 OK): # [ # { # "name": "translate-text", # "author": "FloomAI", # "rating": 4.8, # "title": { "en": "Text Translator", "fr": "...", "es": "..." }, # "description": { "en": "Translates any text to a target language", ... } # } # ] # Query too short (returns empty): # [] ``` -------------------------------- ### Test Python Runtime Directly Source: https://context7.com/floomai/floom/llms.txt This cURL command demonstrates how to test the Python runtime (deployed as an AWS Lambda function) directly. It sends a Python file and a JSON configuration containing input, variables, and environment settings, including the API key. ```bash # The Python runtime is called internally by Floom Core, # but can also be tested directly: curl -X POST https:///prompt \ -F "file=@prompt.py" \ -F 'config={"input":"project deadline extension","variables":{"tone":"formal"},"config":{},"env":{"OPENAI_API_KEY":"sk-..."}}' # Response: # { # "result": "Dear Team,\n\nI am writing to inform you that the project deadline has been extended..." # } ``` -------------------------------- ### List Featured Public Functions Source: https://context7.com/floomai/floom/llms.txt Retrieve a list of all functions tagged as both 'Public' and 'Featured'. This endpoint does not require authentication. ```bash curl -X GET http://localhost:4050/v1/functions/featured ``` ```json # Response (200 OK): # [ # { # "name": "translate-text", # "title": { "en": "Text Translator", "fr": "Traducteur de texte", "es": "Traductor de texto" }, # "description": { "en": "Translates any text to a target language", "fr": "...", "es": "..." }, # "promptPlaceholder": { "en": "Enter text to translate...", "fr": "...", "es": "..." }, # "author": "FloomAI", # "rating": 4.8, # "downloads": [120, 95, 210], # "parameters": [ ... ] # } # ] ``` -------------------------------- ### Deploy Floom Function Source: https://context7.com/floomai/floom/llms.txt Deploys a ZIP archive containing a LangChain `prompt.py` and `manifest.yml` to Floom's function registry. The function's code is stored in S3, and metadata in MongoDB. ```yaml manifest: name: summarize-article description: "Summarizes a news article into 3 bullet points" runtime: language: python framework: langchain entrypoint: prompt: prompt.py parameters: - name: language description: "Target language for the summary" required: false defaultValue: "English" ``` -------------------------------- ### Deploy a Function Source: https://context7.com/floomai/floom/llms.txt Deploys a new function to the Floom AI platform. The function is packaged as a zip file containing a manifest and the function code. ```APIDOC ## POST /v1/functions/deploy ### Description Deploys a new function to the Floom AI platform. The function is packaged as a zip file containing a manifest and the function code. ### Method POST ### Endpoint /v1/functions/deploy ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **file** (file) - Required - The zip file containing the function. ### Request Example ```bash zip my-function.zip manifest.yml prompt.py curl -X POST http://localhost:4050/v1/functions/deploy \ -H "Api-Key: floom_abc123xyz..." \ -F "file=@my-function.zip" ``` ### Response #### Success Response (200 OK) - **message** (string) - Confirmation message of successful deployment. #### Response Example ```json { "message": "Function summarize-article deployed successfully" } ``` ``` -------------------------------- ### Run a Deployed Floom AI Function Source: https://context7.com/floomai/floom/llms.txt Execute a deployed function by its name, providing a prompt and optional parameters. The server will handle fetching the function code and executing it within the Python Lambda runtime. ```bash curl -X POST http://localhost:4050/v1/functions/run \ -H "Content-Type: application/json" \ -d '{ "function": "summarize-article", "prompt": "OpenAI has released GPT-5 with new reasoning capabilities...", "parameters": { "language": "Spanish" } }' ``` ```text # Response (200 OK) — raw output from the LangChain chain: # "• OpenAI lanzó GPT-5 con nuevas capacidades de razonamiento.\n• ..." ``` -------------------------------- ### List Featured Public Functions Source: https://context7.com/floomai/floom/llms.txt Returns all functions tagged with both `Public` and `Featured` roles. No authentication required. ```APIDOC ## GET /v1/functions/featured ### Description Returns all functions tagged with both `Public` and `Featured` roles. No authentication required. ### Method GET ### Endpoint /v1/functions/featured ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET http://localhost:4050/v1/functions/featured ``` ### Response #### Success Response (200 OK) - An array of featured function objects, including name, title, description, author, rating, etc. #### Response Example ```json [ { "name": "translate-text", "title": { "en": "Text Translator", "fr": "Traducteur de texte", "es": "Traductor de texto" }, "description": { "en": "Translates any text to a target language", "fr": "...", "es": "..." }, "promptPlaceholder": { "en": "Enter text to translate...", "fr": "...", "es": "..." }, "author": "FloomAI", "rating": 4.8, "downloads": [120, 95, 210], "parameters": [ ... ] } ] ``` ``` -------------------------------- ### Deploy Floom with Docker Compose Source: https://context7.com/floomai/floom/llms.txt This Docker Compose configuration sets up Floom Core, MongoDB, and Milvus for local development. Adjust environment variables for database credentials, environment type, and authentication as needed. Floom Core will be accessible on port 4050. ```yaml version: '3.8' services: floom: image: floomai/floom:latest container_name: floom-core environment: - FLOOM_DB_ADDRESS=mongo:27017 - FLOOM_DB_USER=root - FLOOM_DB_PASSWORD=MyFloom - FLOOM_ENVIRONMENT=local # 'local' stores assets on disk; 'cloud' uses S3 - FLOOM_AUTHENTICATION=false # Set to 'true' to enforce API key auth - FLOOM_DATABASE_TYPE=mongodb - FLOOM_VDB_VENDOR=Milvus - FLOOM_VDB_ENDPOINT=standalone - FLOOM_VDB_PORT=19530 ports: - "4050:4050" depends_on: mongo: condition: service_healthy mongo: image: mongo environment: - MONGO_INITDB_ROOT_USERNAME=root - MONGO_INITDB_ROOT_PASSWORD=MyFloom ports: - "4060:27017" healthcheck: test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"] interval: 10s retries: 10 ``` -------------------------------- ### Define AI Pipeline with Floom Schema Source: https://context7.com/floomai/floom/llms.txt Use this YAML schema to define a comprehensive AI pipeline, including model connectors, prompt templates, context sources, optimizations, response formatting, and global plugins. Ensure secrets are managed externally. ```yaml kind: 'floom/pipeline/1.2' pipeline: name: customer-support-bot model: - package: floom/model/connector/openai model: gpt-4 api-key: ${{ secrets.OPENAI_API_KEY }} prompt: template: package: floom/prompt/template/default system: "You are a helpful BMW customer support agent. Answer only BMW-related questions." context: - package: floom/prompt/context/pdf path: /etc/myfiles/bmw-manual.pdf optimization: - package: floom/prompt/optimization/compression validation: - package: promptsec/prompt/validation/bad-words-filter language: en-us - package: promptsec/prompt/validation/pii language: en-us response: format: - package: floom/response/formatter type: text language: en max-sentences: 5 max-characters: 2000 validation: - package: promptsec/response/validation/bad-words-filter language: en-us global: - package: floom/global/conversation-history - package: promptsec/global/ddos-protection throttling: timeframe: min max-hits: 10 per: user action: deny - package: floom/global/cost-management alert-threshold: 5000 report-frequency: weekly - package: floom/global/cache cache-type: memory max-size: 512MB ``` -------------------------------- ### Google OAuth Login Source: https://context7.com/floomai/floom/llms.txt Exchanges a Google OAuth authorization code for a Floom session token. Requires server-side configuration of `FLOOM_GOOGLE_CLIENT_ID` and `FLOOM_GOOGLE_CLIENT_SECRET`. ```bash curl -X POST http://localhost:4050/v1/account/google-login \ -H "Content-Type: application/json" \ -d '{ "code": "4/0AX4XfWjG8...", "state": "" }' ``` -------------------------------- ### Upload Asset to Floom Source: https://context7.com/floomai/floom/llms.txt Uploads a file (e.g., PDF, image, CSV) to Floom's asset store. Returns a `fileId` for use in pipeline data contexts. Files are stored locally or in AWS S3 depending on the mode. ```bash curl -X POST http://localhost:4050/v1/assets \ -H "Api-Key: floom_abc123xyz..." \ -F "file=@/path/to/my-document.pdf" ``` -------------------------------- ### GitHub OAuth Login Source: https://context7.com/floomai/floom/llms.txt Exchanges a GitHub OAuth authorization code for a Floom session token. Requires server-side configuration of `FLOOM_GITHUB_CLIENT_ID` and `FLOOM_GITHUB_CLIENT_SECRET`. ```bash curl -X POST http://localhost:4050/v1/account/github-login \ -H "Content-Type: application/json" \ -d '{ "code": "github_auth_code_abc", "state": "random_state_string" }' ``` -------------------------------- ### Logout User Source: https://context7.com/floomai/floom/llms.txt Invalidates the current API key to terminate the user session. Ensure the correct `Api-Key` header is provided. ```bash curl -X GET http://localhost:4050/v1/account/logout \ -H "Api-Key: floom_abc123xyz..." ``` -------------------------------- ### Upload an Asset Source: https://context7.com/floomai/floom/llms.txt Uploads a file to Floom's asset store and returns a unique file ID. ```APIDOC ## POST /v1/assets ### Description Uploads a file (PDF, image, CSV, etc.) to Floom's asset store. In local mode files are stored on disk; in cloud mode they are uploaded to AWS S3 (`FLOOM_S3_BUCKET`). Returns a unique `fileId` for use in pipeline data contexts. ### Method POST ### Endpoint /v1/assets ### Headers - **Api-Key** (string) - Required - The API key for authentication. ### Parameters #### Form Data - **file** (file) - Required - The file to upload. ### Request Example ```bash curl -X POST http://localhost:4050/v1/assets \ -H "Api-Key: floom_abc123xyz..." \ -F "file=@/path/to/my-document.pdf" ``` ### Response #### Success Response (200 OK) - **fileId** (string) - A unique identifier for the uploaded asset. #### Error Response (400) - **error** (string) - Description of the error, e.g., "No asset was provided". ### Response Example (Success) ```json { "fileId": "6478a3b2c1d4e5f6a7b8c9d0" } ``` ### Response Example (Error) ```json { "error": "No asset was provided" } ``` ``` -------------------------------- ### GitHub OAuth Login Source: https://context7.com/floomai/floom/llms.txt Exchanges a GitHub OAuth authorization code for a Floom session token. ```APIDOC ## POST /v1/account/github-login ### Description Exchanges a GitHub OAuth authorization code for a Floom session token. Requires `FLOOM_GITHUB_CLIENT_ID` and `FLOOM_GITHUB_CLIENT_SECRET` environment variables. ### Method POST ### Endpoint /v1/account/github-login ### Parameters #### Request Body - **code** (string) - Required - The GitHub OAuth authorization code. - **state** (string) - Required - A random state string to prevent CSRF attacks. ### Request Example ```bash curl -X POST http://localhost:4050/v1/account/github-login \ -H "Content-Type: application/json" \ -d { "code": "github_auth_code_abc", "state": "random_state_string" } ``` ### Response #### Success Response (200 OK) - **sessionToken** (string) - The Floom session token. ### Response Example ```json { "sessionToken": "floom_github_session_xyz789..." } ``` ``` -------------------------------- ### Search Public Functions Source: https://context7.com/floomai/floom/llms.txt Performs a full-text search across the public function registry. ```APIDOC ## POST /v1/functions/search ### Description Performs a full-text search across the public function registry matching against `name`, `title.en`, and `description.en`. Query must be at least 5 characters. ### Method POST ### Endpoint /v1/functions/search ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **query** (string) - Required - The search query string (minimum 5 characters). ### Request Example ```bash curl -X POST http://localhost:4050/v1/functions/search \ -H "Content-Type: application/json" \ -d { "query": "translate" } ``` ### Response #### Success Response (200 OK) - An array of function objects matching the search query. #### Response Example ```json [ { "name": "translate-text", "author": "FloomAI", "rating": 4.8, "title": { "en": "Text Translator", "fr": "...", "es": "..." }, "description": { "en": "Translates any text to a target language", ... } } ] ``` #### Response Example (Query too short) ```json [] ``` ``` -------------------------------- ### Logout Source: https://context7.com/floomai/floom/llms.txt Invalidates the current API key, terminating the session. ```APIDOC ## GET /v1/account/logout ### Description Invalidates the current API key, terminating the session. ### Method GET ### Endpoint /v1/account/logout ### Headers - **Api-Key** (string) - Required - The API key for the current session. ### Response #### Success Response (200 OK) - "Logged out" ### Request Example ```bash curl -X GET http://localhost:4050/v1/account/logout \ -H "Api-Key: floom_abc123xyz..." ``` ``` -------------------------------- ### Google OAuth Login Source: https://context7.com/floomai/floom/llms.txt Exchanges a Google OAuth authorization code for a Floom session token (API key). ```APIDOC ## POST /v1/account/google-login ### Description Exchanges a Google OAuth authorization code for a Floom session token (API key). Requires `FLOOM_GOOGLE_CLIENT_ID` and `FLOOM_GOOGLE_CLIENT_SECRET` environment variables on the server. ### Method POST ### Endpoint /v1/account/google-login ### Parameters #### Request Body - **code** (string) - Required - The Google OAuth authorization code. - **state** (string) - Optional - The state parameter from the OAuth flow. ### Request Example ```bash curl -X POST http://localhost:4050/v1/account/google-login \ -H "Content-Type: application/json" \ -d { "code": "4/0AX4XfWjG8...", "state": "" } ``` ### Response #### Success Response (200 OK) - **sessionToken** (string) - The Floom session token (API key). ### Response Example ```json { "sessionToken": "floom_google_session_abc123..." } ``` ``` -------------------------------- ### Check Floom Server Health Source: https://context7.com/floomai/floom/llms.txt Verifies the liveness of the Floom server and its MongoDB connection. Expects a 'Healthy' response on success or 'Mongo Unhealthy' on failure. ```bash curl -X GET http://localhost:4050/v1/misc/health ``` -------------------------------- ### Health Check Source: https://context7.com/floomai/floom/llms.txt Checks the liveness of the Floom server and its MongoDB connection. ```APIDOC ## GET /v1/misc/health ### Description Checks liveness of the Floom server and its MongoDB connection. ### Method GET ### Endpoint /v1/misc/health ### Response #### Success Response (200 OK) - "Healthy" #### Unhealthy Response (500) - "Mongo Unhealthy" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.