Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neural_providers/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def load_config(raw_config: Dict[str, Any]) -> Config:
top_p=top_p,
max_tokens=max_tokens,
presence_penalty=presence_penalty,
frequency_penalty=presence_penalty,
frequency_penalty=frequency_penalty,
)


Expand Down
2 changes: 1 addition & 1 deletion neural_providers/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def load_config(raw_config: Dict[str, Any]) -> Config:
top_p=top_p,
max_tokens=max_tokens,
presence_penalty=presence_penalty,
frequency_penalty=presence_penalty,
frequency_penalty=frequency_penalty,
)


Expand Down
15 changes: 15 additions & 0 deletions test/python/test_chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ def test_load_config_errors():
assert str(exc.value) == expected_error, config


def test_load_config_valid_values():
raw = get_valid_config()
raw["presence_penalty"] = 0.5
raw["frequency_penalty"] = 1.0
cfg = chatgpt.load_config(raw)

assert cfg.api_key == raw["api_key"]
assert cfg.model == raw["model"]
assert cfg.temperature == raw["temperature"]
assert cfg.top_p == raw["top_p"]
assert cfg.max_tokens == raw["max_tokens"]
assert cfg.presence_penalty == raw["presence_penalty"]
assert cfg.frequency_penalty == raw["frequency_penalty"]


def test_main_function_rate_other_error():
with mock.patch.object(sys.stdin, 'readline') as readline_mock, \
mock.patch.object(chatgpt, 'get_chatgpt_completion') as compl_mock:
Expand Down
15 changes: 15 additions & 0 deletions test/python/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ def test_load_config_errors():
assert str(exc.value) == expected_error, config


def test_load_config_valid_values():
raw = get_valid_config()
raw["presence_penalty"] = 0.5
raw["frequency_penalty"] = 1.0
cfg = openai.load_config(raw)

assert cfg.api_key == raw["api_key"]
assert cfg.model == raw["model"]
assert cfg.temperature == raw["temperature"]
assert cfg.top_p == raw["top_p"]
assert cfg.max_tokens == raw["max_tokens"]
assert cfg.presence_penalty == raw["presence_penalty"]
assert cfg.frequency_penalty == raw["frequency_penalty"]


def test_main_function_rate_other_error():
with mock.patch.object(sys.stdin, 'readline') as readline_mock, \
mock.patch.object(openai, 'get_openai_completion') as completion_mock:
Expand Down
Loading