Update cassettes again 3

This commit is contained in:
Brandon Hancock
2025-02-18 16:52:30 -05:00
parent 00595e8851
commit 4d2757a4d6
3 changed files with 19 additions and 17 deletions

View File

@@ -21,15 +21,15 @@ interactions:
uri: http://localhost:11434/api/generate
response:
body:
string: '{"model":"llama3.1","created_at":"2025-02-18T21:45:33.813953Z","response":"{\n \"name\":
\"Alice Llama\",\n \"age\": 30\n}","done":true,"done_reason":"stop","context":[128006,882,128007,271,14711,744,512,5618,5625,279,2768,1495,1139,2764,4823,382,5207,27785,279,2764,4823,323,4400,775,382,791,4823,2011,1833,420,3645,7041,512,517,220,330,609,794,610,345,220,330,425,794,528,198,633,14711,2724,512,678,25,30505,445,81101,11,13381,25,220,966,271,128009,128006,78191,128007,271,517,220,330,609,794,330,62786,445,81101,761,220,330,425,794,220,966,198,92],"total_duration":3041185667,"load_duration":22953084,"prompt_eval_count":67,"prompt_eval_duration":2443000000,"eval_count":19,"eval_duration":573000000}'
string: '{"model":"llama3.1","created_at":"2025-02-18T21:52:24.555211Z","response":"{\n \"name\":
\"Alice Llama\", \n \"age\": 30\n}","done":true,"done_reason":"stop","context":[128006,882,128007,271,14711,744,512,5618,5625,279,2768,1495,1139,2764,4823,382,5207,27785,279,2764,4823,323,4400,775,382,791,4823,2011,1833,420,3645,7041,512,517,220,330,609,794,610,345,220,330,425,794,528,198,633,14711,2724,512,678,25,30505,445,81101,11,13381,25,220,966,271,128009,128006,78191,128007,271,517,220,330,609,794,330,62786,445,81101,498,720,220,330,425,794,220,966,198,92],"total_duration":3449060375,"load_duration":806464375,"prompt_eval_count":67,"prompt_eval_duration":2065000000,"eval_count":20,"eval_duration":576000000}'
headers:
Content-Length:
- '705'
- '711'
Content-Type:
- application/json; charset=utf-8
Date:
- Tue, 18 Feb 2025 21:45:33 GMT
- Tue, 18 Feb 2025 21:52:24 GMT
status:
code: 200
message: OK

View File

@@ -21,15 +21,15 @@ interactions:
uri: http://localhost:11434/api/generate
response:
body:
string: '{"model":"llama3.2:3b","created_at":"2025-02-18T21:45:30.754815Z","response":"{\"name\":
\"Alice Llama\", \"age\": 30}","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,744,512,5618,5625,279,2768,1495,1139,2764,4823,382,5207,27785,279,2764,4823,323,4400,775,382,791,4823,2011,1833,420,3645,7041,512,517,220,330,609,794,610,345,220,330,425,794,528,198,633,14711,2724,512,678,25,30505,445,81101,11,13381,25,220,966,271,128009,128006,78191,128007,271,5018,609,794,330,62786,445,81101,498,330,425,794,220,966,92],"total_duration":1168904334,"load_duration":36673209,"prompt_eval_count":82,"prompt_eval_duration":879000000,"eval_count":15,"eval_duration":251000000}'
string: '{"model":"llama3.2:3b","created_at":"2025-02-18T21:52:20.737635Z","response":"{\"name\":
\"Alice Llama\", \"age\": 30}","done":true,"done_reason":"stop","context":[128006,9125,128007,271,38766,1303,33025,2696,25,6790,220,2366,18,271,128009,128006,882,128007,271,14711,744,512,5618,5625,279,2768,1495,1139,2764,4823,382,5207,27785,279,2764,4823,323,4400,775,382,791,4823,2011,1833,420,3645,7041,512,517,220,330,609,794,610,345,220,330,425,794,528,198,633,14711,2724,512,678,25,30505,445,81101,11,13381,25,220,966,271,128009,128006,78191,128007,271,5018,609,794,330,62786,445,81101,498,330,425,794,220,966,92],"total_duration":2438288750,"load_duration":819026959,"prompt_eval_count":82,"prompt_eval_duration":1368000000,"eval_count":15,"eval_duration":249000000}'
headers:
Content-Length:
- '759'
- '761'
Content-Type:
- application/json; charset=utf-8
Date:
- Tue, 18 Feb 2025 21:45:30 GMT
- Tue, 18 Feb 2025 21:52:21 GMT
status:
code: 200
message: OK

View File

@@ -1,4 +1,5 @@
import json
import os
from typing import Dict, List, Optional
from unittest.mock import MagicMock, Mock, patch
@@ -349,12 +350,17 @@ def test_convert_with_instructions():
assert output.age == 30
@pytest.mark.vcr(filter_headers=["authorization"])
# Skip tests that call external APIs when running in CI/CD
skip_external_api = pytest.mark.skipif(
os.getenv("CI") is not None, reason="Skipping tests that call external API in CI/CD"
)
@skip_external_api
@pytest.mark.vcr(filter_headers=["authorization"], record_mode="once")
def test_converter_with_llama3_2_model():
llm = LLM(model="ollama/llama3.2:3b", base_url="http://localhost:11434")
sample_text = "Name: Alice Llama, Age: 30"
instructions = get_conversion_instructions(SimpleModel, llm)
converter = Converter(
llm=llm,
@@ -362,19 +368,17 @@ def test_converter_with_llama3_2_model():
model=SimpleModel,
instructions=instructions,
)
output = converter.to_pydantic()
assert isinstance(output, SimpleModel)
assert output.name == "Alice Llama"
assert output.age == 30
@pytest.mark.vcr(filter_headers=["authorization"])
@skip_external_api
@pytest.mark.vcr(filter_headers=["authorization"], record_mode="once")
def test_converter_with_llama3_1_model():
llm = LLM(model="ollama/llama3.1", base_url="http://localhost:11434")
sample_text = "Name: Alice Llama, Age: 30"
instructions = get_conversion_instructions(SimpleModel, llm)
converter = Converter(
llm=llm,
@@ -382,9 +386,7 @@ def test_converter_with_llama3_1_model():
model=SimpleModel,
instructions=instructions,
)
output = converter.to_pydantic()
assert isinstance(output, SimpleModel)
assert output.name == "Alice Llama"
assert output.age == 30