improve: CI experience (#5168)

This commit is contained in:
Yeuoly 2024-06-13 23:16:28 +08:00 committed by GitHub
parent 0cccf9c67d
commit e8afc416dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 8 deletions

View File

@ -1,6 +1,5 @@
import os import os
from collections.abc import Iterable from collections.abc import Iterable
from time import sleep
from typing import Any, Literal, Union from typing import Any, Literal, Union
import anthropic import anthropic
@ -64,7 +63,6 @@ class MockAnthropicClass:
index = 0 index = 0
for i in range(0, len(full_response_text)): for i in range(0, len(full_response_text)):
sleep(0.1)
yield ContentBlockDeltaEvent( yield ContentBlockDeltaEvent(
type='content_block_delta', type='content_block_delta',
delta=TextDelta(text=full_response_text[i], type='text_delta'), delta=TextDelta(text=full_response_text[i], type='text_delta'),

View File

@ -1,7 +1,7 @@
import re import re
from collections.abc import Generator from collections.abc import Generator
from json import dumps, loads from json import dumps, loads
from time import sleep, time from time import time
# import monkeypatch # import monkeypatch
from typing import Any, Literal, Optional, Union from typing import Any, Literal, Optional, Union
@ -112,7 +112,6 @@ class MockChatClass:
if not function_call: if not function_call:
tool_calls = MockChatClass.generate_tool_calls(tools=tools) tool_calls = MockChatClass.generate_tool_calls(tools=tools)
sleep(1)
return _ChatCompletion( return _ChatCompletion(
id='cmpl-3QJQa5jXJ5Z5X', id='cmpl-3QJQa5jXJ5Z5X',
choices=[ choices=[
@ -151,7 +150,6 @@ class MockChatClass:
full_text = "Hello, world!\n\n```python\nprint('Hello, world!')\n```" full_text = "Hello, world!\n\n```python\nprint('Hello, world!')\n```"
for i in range(0, len(full_text) + 1): for i in range(0, len(full_text) + 1):
sleep(0.1)
if i == len(full_text): if i == len(full_text):
yield ChatCompletionChunk( yield ChatCompletionChunk(
id='cmpl-3QJQa5jXJ5Z5X', id='cmpl-3QJQa5jXJ5Z5X',

View File

@ -1,6 +1,6 @@
import re import re
from collections.abc import Generator from collections.abc import Generator
from time import sleep, time from time import time
# import monkeypatch # import monkeypatch
from typing import Any, Literal, Optional, Union from typing import Any, Literal, Optional, Union
@ -20,7 +20,6 @@ class MockCompletionsClass:
def mocked_openai_completion_create_sync( def mocked_openai_completion_create_sync(
model: str model: str
) -> CompletionMessage: ) -> CompletionMessage:
sleep(1)
return CompletionMessage( return CompletionMessage(
id="cmpl-3QJQa5jXJ5Z5X", id="cmpl-3QJQa5jXJ5Z5X",
object="text_completion", object="text_completion",
@ -48,7 +47,6 @@ class MockCompletionsClass:
) -> Generator[CompletionMessage, None, None]: ) -> Generator[CompletionMessage, None, None]:
full_text = "Hello, world!\n\n```python\nprint('Hello, world!')\n```" full_text = "Hello, world!\n\n```python\nprint('Hello, world!')\n```"
for i in range(0, len(full_text) + 1): for i in range(0, len(full_text) + 1):
sleep(0.1)
if i == len(full_text): if i == len(full_text):
yield CompletionMessage( yield CompletionMessage(
id="cmpl-3QJQa5jXJ5Z5X", id="cmpl-3QJQa5jXJ5Z5X",