The world's first agentic reverse engineer.
feat: add CUSTOM LLM provider variant and LLMConfig fields
Amruth5e0f7f698170
diff --git a/kong/config.py b/kong/config.pyindex 97c1803..9ba6b31 100644--- a/kong/config.py+++ b/kong/config.py@@ -12,10 +12,15 @@ from kong.ghidra.environment import find_ghidra_installclass LLMProvider(Enum):ANTHROPIC = "anthropic"OPENAI = "openai"+ CUSTOM = "custom"@propertydef display_name(self) -> str:- return {LLMProvider.ANTHROPIC: "Anthropic", LLMProvider.OPENAI: "OpenAI"}[self]+ return {+ LLMProvider.ANTHROPIC: "Anthropic",+ LLMProvider.OPENAI: "OpenAI",+ LLMProvider.CUSTOM: "Custom",+ }[self]@dataclass@@ -40,6 +45,10 @@ class LLMConfig:provider: LLMProvider = LLMProvider.ANTHROPICmodel: str | None = Noneapi_key: str | None = None+ base_url: str | None = None+ max_prompt_chars: int | None = None+ max_chunk_functions: int | None = None+ max_output_tokens: int | None = None@dataclassdiff --git a/tests/test_config.py b/tests/test_config.pynew file mode 100644index 0000000..6c225ce--- /dev/null+++ b/tests/test_config.py@@ -0,0 +1,37 @@+from __future__ import annotations++from kong.config import LLMConfig, LLMProvider+++class TestLLMProviderCustom:+ def test_custom_variant_exists(self):+ assert LLMProvider.CUSTOM.value == "custom"++ def test_custom_display_name(self):+ assert LLMProvider.CUSTOM.display_name == "Custom"++ def test_existing_display_names_unchanged(self):+ assert LLMProvider.ANTHROPIC.display_name == "Anthropic"+ assert LLMProvider.OPENAI.display_name == "OpenAI"+++class TestLLMConfigCustomFields:+ def test_defaults_are_none(self):+ cfg = LLMConfig()+ assert cfg.base_url is None+ assert cfg.max_prompt_chars is None+ assert cfg.max_chunk_functions is None+ assert cfg.max_output_tokens is None++ def test_custom_config_with_all_fields(self):+ cfg = LLMConfig(+ provider=LLMProvider.CUSTOM,+ model="llama3:8b",+ base_url="http://localhost:11434/v1",+ max_prompt_chars=32000,+ max_chunk_functions=20,+ max_output_tokens=4096,+ )+ assert cfg.provider is LLMProvider.CUSTOM+ assert cfg.base_url == "http://localhost:11434/v1"+ assert cfg.max_prompt_chars == 32000