Improve LangChain memory implementation
- Swap to RunnableWithMemory - Add verbosity flag
This commit is contained in:
parent
e59cf01ba9
commit
1c75cfc716
5 changed files with 81 additions and 51 deletions
|
@ -23,6 +23,7 @@ class ReviewConfig:
|
|||
paths: List[Path]
|
||||
ollama: OllamaConfig
|
||||
base_branch: str
|
||||
verbose: bool
|
||||
|
||||
|
||||
def create_ollama_config(
|
||||
|
@ -43,19 +44,24 @@ def create_ollama_config(
|
|||
|
||||
|
||||
def create_review_config(
|
||||
paths: List[Path], ollama_config: OllamaConfig, base_branch: str
|
||||
paths: List[Path], ollama_config: OllamaConfig, base_branch: str, verbose
|
||||
) -> ReviewConfig:
|
||||
"""Create complete ReviewConfig from validated components."""
|
||||
return ReviewConfig(paths=paths, ollama=ollama_config, base_branch=base_branch)
|
||||
return ReviewConfig(
|
||||
paths=paths, ollama=ollama_config, base_branch=base_branch, verbose=verbose
|
||||
)
|
||||
|
||||
|
||||
def namespace_to_config(
|
||||
namespace: argparse.Namespace
|
||||
):
|
||||
def namespace_to_config(namespace: argparse.Namespace):
|
||||
"""Transform argparse namespace into ReviewConfig."""
|
||||
paths = [Path(path_str) for path_str in namespace.paths]
|
||||
ollama_config = OllamaConfig(
|
||||
chat_model=namespace.model, base_url=namespace.server_url, system_prompt=namespace.system_prompt, embedding_model=namespace.embedding_model
|
||||
chat_model=namespace.model,
|
||||
base_url=namespace.server_url,
|
||||
system_prompt=namespace.system_prompt,
|
||||
embedding_model=namespace.embedding_model,
|
||||
)
|
||||
|
||||
return create_review_config(paths, ollama_config, namespace.base_branch)
|
||||
return create_review_config(
|
||||
paths, ollama_config, namespace.base_branch, namespace.verbose
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue