Skip to content

Commit d5a273f

Browse files
salmanapSalman Paracha
andauthored
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 <[email protected]> * resolving PR comments --------- Co-authored-by: Salman Paracha <[email protected]>
1 parent 33e90dd commit d5a273f

26 files changed

+2687
-76
lines changed

arch/arch_config_schema.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,31 @@ properties:
331331
model:
332332
type: string
333333
additionalProperties: false
334+
state_storage:
335+
type: object
336+
properties:
337+
type:
338+
type: string
339+
enum:
340+
- memory
341+
- postgres
342+
connection_string:
343+
type: string
344+
description: Required when type is postgres. Supports environment variable substitution using $VAR or ${VAR} syntax.
345+
additionalProperties: false
346+
required:
347+
- type
348+
# Note: connection_string is conditionally required based on type
349+
# If type is 'postgres', connection_string must be provided
350+
# If type is 'memory', connection_string is not needed
351+
allOf:
352+
- if:
353+
properties:
354+
type:
355+
const: postgres
356+
then:
357+
required:
358+
- connection_string
334359
prompt_guards:
335360
type: object
336361
properties:

arch/supervisord.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
nodaemon=true
33

44
[program:brightstaff]
5-
command=sh -c "RUST_LOG=info /app/brightstaff 2>&1 | tee /var/log/brightstaff.log | while IFS= read -r line; do echo '[brightstaff]' \"$line\"; done"
5+
command=sh -c "envsubst < /app/arch_config_rendered.yaml > /app/arch_config_rendered.env_sub.yaml && RUST_LOG=debug ARCH_CONFIG_PATH_RENDERED=/app/arch_config_rendered.env_sub.yaml /app/brightstaff 2>&1 | tee /var/log/brightstaff.log | while IFS= read -r line; do echo '[brightstaff]' \"$line\"; done"
66
stdout_logfile=/dev/stdout
77
redirect_stderr=true
88
stdout_logfile_maxbytes=0

arch/tools/cli/utils.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,24 @@ def get_llm_provider_access_keys(arch_config_file):
148148
if access_key is not None:
149149
access_key_list.append(access_key)
150150

151+
# Extract environment variables from state_storage.connection_string
152+
state_storage = arch_config_yaml.get("state_storage_v1_responses")
153+
if state_storage:
154+
connection_string = state_storage.get("connection_string")
155+
if connection_string and isinstance(connection_string, str):
156+
# Extract all $VAR and ${VAR} patterns from connection string
157+
import re
158+
159+
# Match both $VAR and ${VAR} patterns
160+
pattern = r"\$\{?([A-Z_][A-Z0-9_]*)\}?"
161+
matches = re.findall(pattern, connection_string)
162+
for var in matches:
163+
access_key_list.append(f"${var}")
164+
else:
165+
raise ValueError(
166+
"Invalid connection string received in state_storage_v1_responses"
167+
)
168+
151169
return access_key_list
152170

153171

0 commit comments

Comments
 (0)