🔥 refactor(conftest.py): remove unused fixtures and custom chain classes

The following changes were made:
- Removed the `custom_chain` fixture and the `MyCustomChain` and `CustomChain` classes as they were not being used.
- Removed the `data_processing`, `filter_docs`, `get_request`, and `post_request` fixtures as they were not being used.

🔧 fix(test_agents_template.py): set "dynamic" property to False for all template variables to ensure consistency and improve clarity

🐛 fix(test_chains_template.py): add missing "dynamic" field to template dictionaries to ensure consistency and avoid potential bugs

🔧 fix(test_custom_component.py): fix import statements and remove unused imports to improve code readability and maintainability
✨ feat(test_custom_component.py): add tests for the initialization of the CodeParser, Component, and CustomComponent classes
🔧 fix(test_custom_component.py): fix test names and add missing test cases for the Component and CustomComponent classes

🔨 refactor: refactor server.ts to use uppercase PORT variable for improved semantics
✨ feat: add support for process.env.PORT environment variable to run app on configurable port

🔨 refactor: refactor CustomComponent tests for improved readability and maintainability

🔨 refactor: refactor CodeParser tests for improved readability and maintainability

🔨 refactor: refactor Component tests for improved readability and maintainability

🐛 fix: fix CustomComponent class template validation to raise HTTPException when code is None

🔧 fix(tests): fix syntax error in custom_component._class_template_validation
✨ feat(tests): add test_custom_component_get_code_tree_syntax_error to test CustomComponent.get_code_tree method for raising CodeSyntaxError when given incorrect syntax
✨ feat(tests): add test_custom_component_get_function_entrypoint_args_no_args to test CustomComponent.get_function_entrypoint_args property with a build method with no arguments
✨ feat(tests): add test_custom_component_get_function_entrypoint_return_type_no_return_type to test CustomComponent.get_function_entrypoint_return_type property with a build method with no return type
✨ feat(tests): add test_custom_component_get_main_class_name_no_main_class to test CustomComponent.get_main_class_name property when there is no main class
✨ feat(tests): add test_custom_component_build_not_implemented to test CustomComponent.build method for raising NotImplementedError
✨ feat(tests): add fixtures for custom_chain, data_processing, filter_docs, and get_request

🔧 fix(tests): remove commented out code and unused imports to improve code readability and maintainability

🐛 fix(test_llms_template.py): set "dynamic" property to False for all template properties to ensure static values are used

🐛 fix(test_prompts_template.py): set "dynamic" property to False for all template properties to ensure consistency and improve readability
This commit is contained in:
gustavoschaedler 2023-07-18 01:59:19 +01:00
commit 11f7846e0a
7 changed files with 943 additions and 394 deletions

View file

@ -113,6 +113,7 @@ def test_openai(client: TestClient):
assert template["cache"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -125,6 +126,7 @@ def test_openai(client: TestClient):
}
assert template["verbose"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -137,6 +139,7 @@ def test_openai(client: TestClient):
}
assert template["client"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -149,6 +152,7 @@ def test_openai(client: TestClient):
}
assert template["model_name"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,
@ -170,6 +174,7 @@ def test_openai(client: TestClient):
# Add more assertions for other properties here
assert template["temperature"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,
@ -183,6 +188,7 @@ def test_openai(client: TestClient):
}
assert template["max_tokens"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,
@ -196,6 +202,7 @@ def test_openai(client: TestClient):
}
assert template["top_p"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -209,6 +216,7 @@ def test_openai(client: TestClient):
}
assert template["frequency_penalty"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -222,6 +230,7 @@ def test_openai(client: TestClient):
}
assert template["presence_penalty"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -235,6 +244,7 @@ def test_openai(client: TestClient):
}
assert template["n"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -248,6 +258,7 @@ def test_openai(client: TestClient):
}
assert template["best_of"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -261,6 +272,7 @@ def test_openai(client: TestClient):
}
assert template["model_kwargs"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,
@ -273,6 +285,7 @@ def test_openai(client: TestClient):
}
assert template["openai_api_key"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,
@ -287,6 +300,7 @@ def test_openai(client: TestClient):
}
assert template["batch_size"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -300,6 +314,7 @@ def test_openai(client: TestClient):
}
assert template["request_timeout"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -312,6 +327,7 @@ def test_openai(client: TestClient):
}
assert template["logit_bias"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -324,6 +340,7 @@ def test_openai(client: TestClient):
}
assert template["max_retries"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -337,6 +354,7 @@ def test_openai(client: TestClient):
}
assert template["streaming"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -361,6 +379,7 @@ def test_chat_open_ai(client: TestClient):
assert template["verbose"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -374,6 +393,7 @@ def test_chat_open_ai(client: TestClient):
}
assert template["client"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -386,6 +406,7 @@ def test_chat_open_ai(client: TestClient):
}
assert template["model_name"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,
@ -409,6 +430,7 @@ def test_chat_open_ai(client: TestClient):
}
assert template["temperature"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,
@ -422,6 +444,7 @@ def test_chat_open_ai(client: TestClient):
}
assert template["model_kwargs"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,
@ -434,6 +457,7 @@ def test_chat_open_ai(client: TestClient):
}
assert template["openai_api_key"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,
@ -448,6 +472,7 @@ def test_chat_open_ai(client: TestClient):
}
assert template["request_timeout"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -460,6 +485,7 @@ def test_chat_open_ai(client: TestClient):
}
assert template["max_retries"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -473,6 +499,7 @@ def test_chat_open_ai(client: TestClient):
}
assert template["streaming"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -486,6 +513,7 @@ def test_chat_open_ai(client: TestClient):
}
assert template["n"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
@ -500,6 +528,7 @@ def test_chat_open_ai(client: TestClient):
assert template["max_tokens"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": True,
"multiline": False,