INNER CODE UNIT · Python

remaining

skyportal/skyportal · services/assistant/app.py:244

def remaining(deadline, floor=5.0):
    """Seconds left before the answer is due, or None when too few to be useful."""
    left = deadline - time.monotonic()
    return left if left >= floor else None


def answer(conversation, context_type, context_id, user, token):
    """The answer, the tools it took to get there, and any filter it built."""
    tools = list_tools(token, context_type)
    offered = {tool["function"]["name"] for tool in tools}
    messages = build_messages(conversation, MAX_CONTEXT, context_type, context_id, user)
    trace = []

    deadline = time.monotonic() + ANSWER_TIMEOUT
    # One round-trip can ask for several tools at once, so count the calls
    # themselves. Counting round-trips lets a paging model run four times over.
    calls_made = 0
    while calls_made < MAX_TOOL_CALLS:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…