Skip to content

utils

Class info

🛈 DocStrings

Utilities package.

setup_env

setup_env(env: Environment)

Used as extension point for the jinjarope environment.

Parameters:

Name Type Description Default
env Environment

The jinjarope environment to extend

required
Source code in src/llmling_agent/utils/__init__.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
def setup_env(env: jinja2.Environment):
    """Used as extension point for the jinjarope environment.

    Args:
        env: The jinjarope environment to extend
    """
    from llmling_agent.agent.agent import Agent
    from llmling_agent_functional import (
        run_agent,
        run_agent_sync,
        get_structured,
        get_structured_multiple,
        pick_one,
    )

    env.globals |= dict(agent=Agent)
    env.filters |= {
        "run_agent": run_agent,
        "run_agent_sync": run_agent_sync,
        "pick_one": pick_one,
        "get_structured": get_structured,
        "get_structured_multiple": get_structured_multiple,
    }