feat: add sampling options (#2)

* make test more reproducible

* add sampling options ClaudeMessages.Options
This commit is contained in:
jvmncs
2024-03-07 16:08:31 -05:00
committed by GitHub
parent 98b8cafa69
commit 3a2c3fcc0d
2 changed files with 76 additions and 13 deletions

View File

@@ -5,11 +5,12 @@ import pytest
@pytest.mark.vcr
def test_prompt():
model = llm.get_model("claude-3-opus")
model.key = "sk-..."
model.key = model.key or "sk-..." # don't override existing key
response = model.prompt("Two names for a pet pelican, be brief")
assert str(response) == "1. Pelly\n2. Beaky"
assert response.response_json == {
"id": "msg_01QPXzRdFQ5sibaQezm3b8Dz",
response_dict = response.response_json
response_dict.pop("id") # differs between requests
assert response_dict == {
"content": [{"text": "1. Pelly\n2. Beaky", "type": "text"}],
"model": "claude-3-opus-20240229",
"role": "assistant",