Skip to content

Commit 603783e

Browse files
docs: address OpenAI gateway review feedback
Co-authored-by: openhands <openhands@all-hands.dev>
1 parent 998ef46 commit 603783e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

sdk/guides/agent-server/openai-gateway.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,18 @@ If the UI can store a response header and send a custom request header, persist
167167
Voice platforms and webhook integrations usually have their own session or call ID. Store a mapping from that external ID to the OpenHands conversation ID:
168168

169169
```python
170+
import os
171+
172+
# Initialize this once at app startup, or replace it with durable session storage.
173+
conversation_ids: dict[str, str] = {}
174+
170175
conversation_id = conversation_ids.get(platform_session_id)
171176
headers = {}
172177
if conversation_id:
173178
headers["X-OpenHands-ServerConversation-ID"] = conversation_id
174179

175180
response = client.chat.completions.with_raw_response.create(
176-
model="openhands_gateway_demo",
181+
model=os.environ.get("OPENHANDS_MODEL", "openhands_gateway_demo"),
177182
messages=[{"role": "user", "content": transcript_text}],
178183
extra_headers=headers,
179184
)

0 commit comments

Comments
 (0)