mirror of
https://github.com/katanemo/plano.git
synced 2026-04-25 08:46:24 +02:00
enable state management for v1/responses (#631)
* first commit with tests to enable state mamangement via memory * fixed logs to follow the conversational flow a bit better * added support for supabase * added the state_storage_v1_responses flag, and use that to store state appropriately * cleaned up logs and fixed issue with connectivity for llm gateway in weather forecast demo * fixed mixed inputs from openai v1/responses api (#632) * fixed mixed inputs from openai v1/responses api * removing tracing from model-alias-rouing * handling additional input types from openairs --------- Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-342.local> * resolving PR comments --------- Co-authored-by: Salman Paracha <salmanparacha@MacBook-Pro-342.local>
This commit is contained in:
parent
33e90dd338
commit
d5a273f740
26 changed files with 2687 additions and 76 deletions
31
docs/db_setup/conversation_states.sql
Normal file
31
docs/db_setup/conversation_states.sql
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
-- Conversation State Storage Table
|
||||
-- This table stores conversational context for the OpenAI Responses API
|
||||
-- Run this SQL against your PostgreSQL/Supabase database before enabling conversation state storage
|
||||
|
||||
CREATE TABLE IF NOT EXISTS conversation_states (
|
||||
response_id TEXT PRIMARY KEY,
|
||||
input_items JSONB NOT NULL,
|
||||
created_at BIGINT NOT NULL,
|
||||
model TEXT NOT NULL,
|
||||
provider TEXT NOT NULL,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Indexes for common query patterns
|
||||
CREATE INDEX IF NOT EXISTS idx_conversation_states_created_at
|
||||
ON conversation_states(created_at);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_conversation_states_provider
|
||||
ON conversation_states(provider);
|
||||
|
||||
-- Optional: Add a policy for automatic cleanup of old conversations
|
||||
-- Uncomment and adjust the retention period as needed
|
||||
-- CREATE INDEX IF NOT EXISTS idx_conversation_states_updated_at
|
||||
-- ON conversation_states(updated_at);
|
||||
|
||||
COMMENT ON TABLE conversation_states IS 'Stores conversation history for OpenAI Responses API continuity';
|
||||
COMMENT ON COLUMN conversation_states.response_id IS 'Unique identifier for the conversation state';
|
||||
COMMENT ON COLUMN conversation_states.input_items IS 'JSONB array of conversation messages and context';
|
||||
COMMENT ON COLUMN conversation_states.created_at IS 'Unix timestamp (seconds) when the conversation started';
|
||||
COMMENT ON COLUMN conversation_states.model IS 'Model name used for this conversation';
|
||||
COMMENT ON COLUMN conversation_states.provider IS 'LLM provider (e.g., openai, anthropic, bedrock)';
|
||||
Loading…
Add table
Add a link
Reference in a new issue