🔨 refactor(test_chains_template.py): remove unused test functions to improve code readability and maintainability
This commit is contained in:
parent
941cdd4990
commit
71aeda669e
1 changed files with 0 additions and 164 deletions
|
|
@ -9,170 +9,6 @@ from fastapi.testclient import TestClient
|
||||||
# assert set(chains.keys()) == set(settings.chains)
|
# assert set(chains.keys()) == set(settings.chains)
|
||||||
|
|
||||||
|
|
||||||
# Test the ConversationChain object
|
|
||||||
def test_conversation_chain(client: TestClient, logged_in_headers):
|
|
||||||
response = client.get("api/v1/all", headers=logged_in_headers)
|
|
||||||
assert response.status_code == 200
|
|
||||||
json_response = response.json()
|
|
||||||
chains = json_response["chains"]
|
|
||||||
|
|
||||||
chain = chains["ConversationChain"]
|
|
||||||
# Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects
|
|
||||||
assert set(chain["base_classes"]) == {
|
|
||||||
"ConversationChain",
|
|
||||||
"LLMChain",
|
|
||||||
"Chain",
|
|
||||||
"Callable",
|
|
||||||
}
|
|
||||||
|
|
||||||
template = chain["template"]
|
|
||||||
assert template["memory"] == {
|
|
||||||
"required": False,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": True,
|
|
||||||
"multiline": False,
|
|
||||||
"password": False,
|
|
||||||
"name": "memory",
|
|
||||||
"type": "BaseMemory",
|
|
||||||
"list": False,
|
|
||||||
"advanced": False,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
assert template["verbose"] == {
|
|
||||||
"required": False,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": False,
|
|
||||||
"multiline": False,
|
|
||||||
"password": False,
|
|
||||||
"name": "verbose",
|
|
||||||
"type": "bool",
|
|
||||||
"list": False,
|
|
||||||
"advanced": True,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
assert template["llm"] == {
|
|
||||||
"required": True,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": True,
|
|
||||||
"multiline": False,
|
|
||||||
"password": False,
|
|
||||||
"name": "llm",
|
|
||||||
"type": "BaseLanguageModel",
|
|
||||||
"list": False,
|
|
||||||
"advanced": False,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
assert template["input_key"] == {
|
|
||||||
"required": True,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": True,
|
|
||||||
"multiline": False,
|
|
||||||
"value": "input",
|
|
||||||
"password": False,
|
|
||||||
"name": "input_key",
|
|
||||||
"type": "str",
|
|
||||||
"list": False,
|
|
||||||
"advanced": True,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
assert template["output_key"] == {
|
|
||||||
"required": True,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": True,
|
|
||||||
"multiline": False,
|
|
||||||
"value": "response",
|
|
||||||
"password": False,
|
|
||||||
"name": "output_key",
|
|
||||||
"type": "str",
|
|
||||||
"list": False,
|
|
||||||
"advanced": True,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
assert template["_type"] == "ConversationChain"
|
|
||||||
|
|
||||||
# Test the description object
|
|
||||||
assert (
|
|
||||||
chain["description"]
|
|
||||||
== "Chain to have a conversation and load context from memory."
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_llm_chain(client: TestClient, logged_in_headers):
|
|
||||||
response = client.get("api/v1/all", headers=logged_in_headers)
|
|
||||||
assert response.status_code == 200
|
|
||||||
json_response = response.json()
|
|
||||||
chains = json_response["chains"]
|
|
||||||
chain = chains["LLMChain"]
|
|
||||||
|
|
||||||
# Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects
|
|
||||||
assert set(chain["base_classes"]) == {
|
|
||||||
"Callable",
|
|
||||||
"LLMChain",
|
|
||||||
"Chain",
|
|
||||||
}
|
|
||||||
|
|
||||||
template = chain["template"]
|
|
||||||
assert template["memory"] == {
|
|
||||||
"required": False,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": True,
|
|
||||||
"multiline": False,
|
|
||||||
"password": False,
|
|
||||||
"name": "memory",
|
|
||||||
"type": "BaseMemory",
|
|
||||||
"list": False,
|
|
||||||
"advanced": False,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
assert template["verbose"] == {
|
|
||||||
"required": False,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": False,
|
|
||||||
"multiline": False,
|
|
||||||
"value": False,
|
|
||||||
"password": False,
|
|
||||||
"name": "verbose",
|
|
||||||
"type": "bool",
|
|
||||||
"list": False,
|
|
||||||
"advanced": True,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
assert template["llm"] == {
|
|
||||||
"required": True,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": True,
|
|
||||||
"multiline": False,
|
|
||||||
"password": False,
|
|
||||||
"name": "llm",
|
|
||||||
"type": "BaseLanguageModel",
|
|
||||||
"list": False,
|
|
||||||
"advanced": False,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
assert template["output_key"] == {
|
|
||||||
"required": True,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": True,
|
|
||||||
"multiline": False,
|
|
||||||
"value": "text",
|
|
||||||
"password": False,
|
|
||||||
"name": "output_key",
|
|
||||||
"type": "str",
|
|
||||||
"list": False,
|
|
||||||
"advanced": True,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def test_llm_checker_chain(client: TestClient, logged_in_headers):
|
def test_llm_checker_chain(client: TestClient, logged_in_headers):
|
||||||
response = client.get("api/v1/all", headers=logged_in_headers)
|
response = client.get("api/v1/all", headers=logged_in_headers)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue