Skip to content

Commit 92d2cd5

Browse files
fix: Type checking fixes
1 parent 35f3459 commit 92d2cd5

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

tests/integration/conftest.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
from contextlib import contextmanager, redirect_stdout
2-
from dataclasses import dataclass
3-
import os
4-
from typing import Any, ContextManager, Generator
51
import io
6-
from typing import TextIO
2+
import os
73
import uuid
8-
import pytest
4+
from contextlib import contextmanager, redirect_stdout
5+
from dataclasses import dataclass
6+
from typing import Any, ContextManager, Generator, TextIO
7+
98
import dotenv
9+
import pytest
1010
from humanloop.client import Humanloop
11+
from humanloop.requests.prompt_kernel_request import PromptKernelRequestParams
1112

1213

1314
@dataclass
@@ -55,7 +56,7 @@ def sdk_test_dir(humanloop_test_client: Humanloop) -> Generator[str, None, None]
5556

5657

5758
@pytest.fixture(scope="function")
58-
def test_prompt_config() -> dict[str, Any]:
59+
def test_prompt_config() -> PromptKernelRequestParams:
5960
return {
6061
"provider": "openai",
6162
"model": "gpt-4o-mini",

tests/integration/test_prompts.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from humanloop.client import Humanloop
2+
23
from tests.integration.conftest import TestIdentifiers
34

45

@@ -7,17 +8,17 @@ def test_prompts_call(
78
prompt: TestIdentifiers,
89
test_prompt_config: TestIdentifiers,
910
) -> None:
10-
response = humanloop_test_client.prompts.call(
11+
response = humanloop_test_client.prompts.call( # type: ignore [attr-defined]
1112
path=prompt.file_path,
12-
prompt={**test_prompt_config},
13+
prompt={**test_prompt_config}, # type: ignore [misc, arg-type, typeddict-item, dict-item, list-item]
1314
inputs={"question": "What is the capital of the France?"},
1415
)
1516
assert response is not None
1617
assert response.log_id is not None
1718
assert response.logs is not None
1819
for log in response.logs:
1920
assert log is not None
20-
assert log.output or log.error or log.output_message is not None
21+
assert log.output is not None
2122
assert "Paris" in log.output
2223
assert response.prompt.path == prompt.file_path
2324

@@ -27,16 +28,16 @@ def test_prompts_call_stream(
2728
prompt: TestIdentifiers,
2829
test_prompt_config: TestIdentifiers,
2930
) -> None:
30-
response = humanloop_test_client.prompts.call_stream(
31+
response = humanloop_test_client.prompts.call_stream( # type: ignore [attr-defined]
3132
path=prompt.file_path,
32-
prompt={**test_prompt_config},
33+
prompt={**test_prompt_config}, # type: ignore [misc, arg-type, typeddict-item, dict-item, list-item]
3334
inputs={"question": "What is the capital of the France?"},
3435
)
3536

3637
output = ""
3738
for chunk in response:
3839
assert chunk is not None
39-
assert chunk.output or chunk.error or chunk.output_message is not None
40+
assert chunk.output is not None
4041
assert chunk.id is not None
4142
assert chunk.prompt_id is not None
4243
assert chunk.version_id is not None

0 commit comments

Comments
 (0)