Skip to content

Commit a66eed6

Browse files
committed
verify model choice in responses chat session
1 parent 50db5c8 commit a66eed6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

spec/openai_spec.moon

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,37 @@ describe "OpenAI API Client", ->
462462
second
463463
}, session.response_history
464464

465+
it "uses custom model in session", ->
466+
client = OpenAI "test-api-key"
467+
468+
stub(client, "_request").invokes (c, method, path, payload) ->
469+
assert.same "POST", method
470+
assert.same "/responses", path
471+
assert.same "my-custom-model", payload.model
472+
473+
200, {
474+
id: "resp_custom"
475+
object: "response"
476+
model: "my-custom-model"
477+
output: {
478+
{
479+
type: "message"
480+
role: "assistant"
481+
content: {
482+
{ type: "output_text", text: "Custom model reply" }
483+
}
484+
}
485+
}
486+
usage: {}
487+
status: "completed"
488+
}
489+
490+
session = client\new_response_chat_session { model: "my-custom-model" }
491+
response = assert session\send "Hello"
492+
493+
assert.same "resp_custom", response.id
494+
assert.same "Custom model reply", response.output_text
495+
465496
it "retrieves a stored response by id (raw API)", ->
466497
client = OpenAI "test-api-key"
467498

0 commit comments

Comments
 (0)