Module phc.services.agents

Expand source code
from typing import Dict, List, Union
from phc.base_client import BaseClient


class Agents(BaseClient):
    """
    Provides access to the PHC agents API, which allows you to call LLM-based agents.
    """

    def invoke_basic(self, body: Union[str, List[Dict]]):
        """
        Invokes a basic agent, which supports either a basic prompt string or a list of
        messages which can include images as data urls. Requires the `invokeAgent` ABAC
        permission with `agent: "api-basic-agent"` in the policy, or the `accessAdmin`
        permission.
        """
        return self._api_call(
            "/v1/agents/basic/invoke", json={"input": body}, http_verb="POST"
        )

Classes

class Agents (session: phc.session.Session, run_async: bool = False, timeout: int = 30, trust_env: bool = False)

Provides access to the PHC agents API, which allows you to call LLM-based agents.

Expand source code
class Agents(BaseClient):
    """
    Provides access to the PHC agents API, which allows you to call LLM-based agents.
    """

    def invoke_basic(self, body: Union[str, List[Dict]]):
        """
        Invokes a basic agent, which supports either a basic prompt string or a list of
        messages which can include images as data urls. Requires the `invokeAgent` ABAC
        permission with `agent: "api-basic-agent"` in the policy, or the `accessAdmin`
        permission.
        """
        return self._api_call(
            "/v1/agents/basic/invoke", json={"input": body}, http_verb="POST"
        )

Ancestors

  • phc.base_client.BaseClient

Methods

def invoke_basic(self, body: Union[str, List[Dict[~KT, ~VT]]])

Invokes a basic agent, which supports either a basic prompt string or a list of messages which can include images as data urls. Requires the invokeAgent ABAC permission with agent: "api-basic-agent" in the policy, or the accessAdmin permission.

Expand source code
def invoke_basic(self, body: Union[str, List[Dict]]):
    """
    Invokes a basic agent, which supports either a basic prompt string or a list of
    messages which can include images as data urls. Requires the `invokeAgent` ABAC
    permission with `agent: "api-basic-agent"` in the policy, or the `accessAdmin`
    permission.
    """
    return self._api_call(
        "/v1/agents/basic/invoke", json={"input": body}, http_verb="POST"
    )