Skip to content

Ia

AI Actions

The IA actions exposed by ia.py are documented below. Only functions decorated with @decorators.robotaction are listed.

Note: action return keys become robot state variables — use the exact key name prefixed with $ (for example $chatbot_response).


openai_gpt

Send requests to the Marvin assistant using the OpenAI-compatible API implemented in the code.

Signature / Parameters (use exact names): - model_name: str - api_key: str - instructions: str - content: str - files: list = None - file_name: str = None - file_path: str = None

Returns (state variables): - chatbot_response — assistant response (text or list as in code). - file_path — when a Word file is generated, full path to the file (optional).

Exceptions observed in the code: - UnsupportedMidiaType — unsupported media type. - Exception — general errors during processing/files/assistant.

Minimal example:

openai_gpt("gpt-4o", "API_KEY", "Analyze these data", "My content here", files=None)
chatbot_response = $chatbot_response


langchain_openai

LangChain wrapper action for supported models (parameters and returns follow the code).

Signature / Parameters: - model_name: str - messages: list - api_key: str - temperature: float = 0 - file_path: str = None - file_name: str = None

Returns (state variables): - chatbot_response — response returned by the model (text). - file_path — when applicable, path to the generated Word document.

Exceptions: - UnsupportedModelException — when model_name is not in the supported list. - UnsupportedMidiaType — when messages include unsupported media. - Exception — general errors.

Minimal example:

messages = [
    {"type": "SYSTEM", "content": "Instructions"},
    {"type": "HUMAN", "content": "User question"}
]
langchain_openai("gpt-3.5-turbo", messages, "API_KEY")
chatbot_response = $chatbot_response


If you want, I can also add concise end-to-end examples (openai_gpt: open -> send -> save) or run a repo check for doc consistency.