Skip to content

Commit

Permalink
Simplify Client setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
yaph committed Oct 16, 2024
1 parent b78960c commit b963e35
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions charla/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,14 @@ def run(argv: argparse.Namespace) -> None:
# Prompt used to give directions to the model at the beginning of the chat.
system_prompt = argv.system_prompt.read() if argv.system_prompt else ''

# Determine client class and import corresponding module.
client_cls: Any = None
# Determine which Client class to import.
if argv.provider == 'ollama':
from charla.client.ollama import OllamaClient
client_cls = OllamaClient
from charla.client.ollama import OllamaClient as ApiClient
elif argv.provider == 'github':
from charla.client.github import AzureClient
client_cls = AzureClient
from charla.client.github import AzureClient as ApiClient

# Start model API client before chat REPL in case of model errors.
client = client_cls(argv.model, system=system_prompt, message_limit=argv.message_limit)
client = ApiClient(argv.model, system=system_prompt, message_limit=argv.message_limit)
client.set_info()

# Prompt history used for auto completion.
Expand Down

0 comments on commit b963e35

Please sign in to comment.