Skip to content

pi_llm: LiteLLM stream, tools assemble, credentials, errors #20

Description

@maozhen520

Parent

What to build

A thin LLM adapter that, against recorded/handwritten chunks (no live API), can stream completions for UI, assemble modern tool calls before execution, probe capabilities, resolve credentials (env then optional auth.json), and surface OpenAI-mapped errors.

Acceptance criteria

  • Public stream/completion surface uses LiteLLM OpenAI Chat Completions contract (acompletion, modern tools/tool_choice)
  • Streaming yields incremental assistant text suitable for UI consumers
  • Tool calls are fully assembled before any execute handoff
  • Capability probes report unsupported features without crashing the caller
  • Credentials resolve env-first, then optional ~/.pi/agent/auth.json
  • Provider/auth failures map to an OpenAI-shaped error surface
  • Pytest coverage uses fixtures only — no live LLM required

Blocked by

  • Scaffold uv workspace, four packages, and CI

Metadata

Metadata

Assignees

Labels

ready-for-agentFully specified, ready for an AFK agent

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions