mirror of
https://github.com/lobehub/lobehub
synced 2026-04-21 17:47:27 +00:00
* add response api framework * finish response api structure * finish response api structure * ✨ feat: implement basic text generation for Response API (LOBE-5858) - Add instructions extraction from system/developer input messages - Add instructions param to ExecAgentParams, append to agent systemRole - Implement extractPrompt, extractAssistantContent, extractUsage in ResponsesService - Wire up execAgent + executeSync flow for non-streaming and streaming - Add logprobs field to output_text content parts for schema compliance - Fix truncation field to output string enum instead of object Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ✨ feat: implement real token-level streaming for Response API (LOBE-5859) - Replace fake streaming (executeSync → emit events) with real streaming - Subscribe to InMemoryStreamEventManager for live stream_chunk events - Run executeSync in background, convert text chunks to output_text.delta SSE events - Add missing schema fields: item_id on content_part/text events, logprobs on delta/done events - Fix content_part.added/done to include item_id per OpenResponses spec Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ✨ feat: implement tool calling output extraction for Response API (LOBE-5860) - Add extractOutputItems to convert AgentState messages to OpenResponses output items - Extract assistant tool_calls → function_call output items - Extract tool result messages → function_call_output output items - Skip message items for assistant messages that have tool_calls (avoid duplicates) - Add status field to function_call_output items per OpenResponses spec - Update FunctionCallOutputItemSchema with optional status field - Output array reflects execution order: function_call → function_call_output → message Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ✨ feat: implement multi-turn conversations via previous_response_id (LOBE-5861) Encode topicId in response.id to enable stateless multi-turn conversation chaining. When previous_response_id is provided, extract topicId and pass to execAgent via appContext, which automatically loads history messages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * 🐛 fix: add missing type fields for OpenResponses compliance (logprobs, item_id, input_tokens_details) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
54 lines
1.9 KiB
Bash
Executable file
54 lines
1.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# OpenResponses Compliance Test Runner
|
|
# Clones the official test suite locally and runs it against a local server.
|
|
#
|
|
# Usage:
|
|
# ./scripts/compliance-test.sh # uses APP_URL env var
|
|
# ./scripts/compliance-test.sh --filter basic-response # filter tests
|
|
# ./scripts/compliance-test.sh --base-url http://localhost:3010/api/v1 --api-key <key>
|
|
#
|
|
# Environment variables:
|
|
# APP_URL - App base URL (default: http://localhost:3010), auto-appends /api/v1
|
|
# API_KEY - API key for authentication
|
|
#
|
|
# All flags are forwarded to the upstream CLI (run with --help to see all options).
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
REPO_URL="https://github.com/openresponses/openresponses.git"
|
|
CACHE_DIR="$SCRIPT_DIR/openresponses-compliance"
|
|
BRANCH="main"
|
|
|
|
# Clone or update the test suite
|
|
if [ -d "$CACHE_DIR/.git" ]; then
|
|
echo "Updating cached test suite..."
|
|
git -C "$CACHE_DIR" fetch --depth 1 origin "$BRANCH" --quiet
|
|
git -C "$CACHE_DIR" checkout FETCH_HEAD --quiet
|
|
else
|
|
echo "Cloning test suite (one-time)..."
|
|
git clone --depth 1 --branch "$BRANCH" "$REPO_URL" "$CACHE_DIR" --quiet
|
|
fi
|
|
|
|
# Install deps (bun is fast, skips if lock unchanged)
|
|
cd "$CACHE_DIR"
|
|
bun install --frozen-lockfile --silent 2>/dev/null || bun install --silent
|
|
|
|
# Build default args from env vars (can be overridden by explicit flags)
|
|
DEFAULT_ARGS=()
|
|
|
|
# Auto-detect --base-url from APP_URL if not explicitly provided
|
|
if ! echo "$@" | grep -q -- "--base-url\|-u"; then
|
|
BASE_URL="${APP_URL:-http://localhost:3010}/api/v1"
|
|
DEFAULT_ARGS+=(--base-url "$BASE_URL")
|
|
fi
|
|
|
|
# Auto-detect --api-key from API_KEY if not explicitly provided
|
|
if ! echo "$@" | grep -q -- "--api-key\|-k"; then
|
|
if [ -n "${API_KEY:-}" ]; then
|
|
DEFAULT_ARGS+=(--api-key "$API_KEY")
|
|
fi
|
|
fi
|
|
|
|
# Run the compliance test CLI
|
|
exec bun run bin/compliance-test.ts "${DEFAULT_ARGS[@]}" "$@"
|