Skip to content

Commit

Permalink
reruns -> max_runs
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz committed May 15, 2024
1 parent 437144c commit 8512feb
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 14 deletions.
6 changes: 2 additions & 4 deletions cookbook/flows/github_digest/repo_activity.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import inspect
from datetime import date, datetime, timedelta
from datetime import UTC, date, datetime, timedelta

import marvin
from marvin.utilities.jinja import BaseTemplate, JinjaEnvironment
Expand Down Expand Up @@ -145,7 +145,7 @@ async def daily_github_digest(
if lookback_days is None:
lookback_days = 1 if date.today().weekday() != 0 else 3

since = datetime.utcnow() - timedelta(days=lookback_days)
since = datetime.now(UTC) - timedelta(days=lookback_days)

data_future = await get_repo_activity_data.submit(
owner=owner,
Expand All @@ -164,8 +164,6 @@ async def daily_github_digest(
contributors_activity=await data_future.result(),
)

marvin.settings.openai.chat.completions.model = "gpt-4o"

epic_story = write_a_tasteful_epic(markdown_digest)

image_url = draw_a_movie_poster(epic_story).data[0].url
Expand Down
2 changes: 1 addition & 1 deletion tests/ai/test_classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_return_index(self):
assert result == 1

class TestExamples:
@pytest.mark.flaky(reruns=3)
@pytest.mark.flaky(max_runs=3)
async def test_hogwarts_sorting_hat(self):
description = "Brave, daring, chivalrous -- it's Harry Potter!"

Expand Down
2 changes: 1 addition & 1 deletion tests/ai/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_extract_names(self):
)
assert result == ["John", "Mary", "Bob"]

@pytest.mark.flaky(reruns=3)
@pytest.mark.flaky(max_runs=3)
def test_float_to_int(self):
# gpt 3.5 sometimes struggles with this test, marked as flaky
# pydantic no longer casts floats to ints, but gpt-3.5 assumes it's
Expand Down
2 changes: 1 addition & 1 deletion tests/ai/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class RentalHistory(BaseModel):
"""
)

@pytest.mark.flaky(reruns=3)
@pytest.mark.flaky(max_runs=3)
def test_resume(self):
class Experience(BaseModel):
technology: str
Expand Down
2 changes: 1 addition & 1 deletion tests/ai/vision/test_caption.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def use_gpt4o_for_all_tests(gpt_4):
pass


@pytest.mark.flaky(reruns=2)
@pytest.mark.flaky(max_runs=2)
class TestVisionCaption:
def test_ny(self):
img = marvin.Image(
Expand Down
4 changes: 2 additions & 2 deletions tests/ai/vision/test_cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def use_gpt4o_for_all_tests(gpt_4):
pass


@pytest.mark.flaky(reruns=3)
@pytest.mark.flaky(max_runs=3)
class TestVisionCast:
def test_cast_ny(self):
img = marvin.Image(
Expand Down Expand Up @@ -78,7 +78,7 @@ def test_map(self):
assert_locations_equal(result[0], Location(city="New York", state="NY"))
assert_locations_equal(result[1], Location(city="Washington", state="DC"))

@pytest.mark.flaky(reruns=2)
@pytest.mark.flaky(max_runs=2)
async def test_async_map(self):
ny = marvin.Image(
"https://images.unsplash.com/photo-1568515387631-8b650bbcdb90"
Expand Down
2 changes: 1 addition & 1 deletion tests/ai/vision/test_classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def use_gpt4o_for_all_tests(gpt_4):
pass


@pytest.mark.flaky(reruns=2)
@pytest.mark.flaky(max_runs=2)
class TestVisionClassify:
def test_ny_image_input(self):
img = marvin.Image(
Expand Down
4 changes: 2 additions & 2 deletions tests/ai/vision/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def use_gpt4o_for_all_tests(gpt_4):
pass


@pytest.mark.flaky(reruns=2)
@pytest.mark.flaky(max_runs=2)
class TestVisionExtract:
def test_ny_image_input(self):
img = marvin.Image(
Expand Down Expand Up @@ -50,7 +50,7 @@ def test_two_cities(self):
assert_locations_equal(locations[0], Location(city="New York", state="NY"))
assert_locations_equal(locations[1], Location(city="Washington", state="DC"))

@pytest.mark.flaky(reruns=3)
@pytest.mark.flaky(max_runs=3)
def test_dog(self):
class Animal(BaseModel, frozen=True):
type: Literal["cat", "dog", "bird", "frog", "horse", "pig"]
Expand Down
2 changes: 1 addition & 1 deletion tests/beta/assistants/test_assistants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_code_interpreter(self):
assert 85 <= output <= 95


@pytest.mark.flaky(reruns=2)
@pytest.mark.flaky(max_runs=2)
class TestLifeCycle:
@patch.object(client.beta.assistants, "delete", wraps=client.beta.assistants.delete)
@patch.object(client.beta.assistants, "create", wraps=client.beta.assistants.create)
Expand Down

0 comments on commit 8512feb

Please sign in to comment.