fix memory router naming

This commit is contained in:
Xi Yan 2024-09-22 22:30:53 -07:00
parent 28065ca53a
commit e0ad4fb99c
3 changed files with 52 additions and 41 deletions

View file

@ -81,17 +81,19 @@ def configure_api_providers(
except Exception:
existing = None
cfg = prompt_for_config(config_type, existing)
if api_str in router_api2builtin_api:
# a routing api, we need to infer and assign it a routing_key and put it in the routing_table
routing_key = prompt(
"> Enter routing key for the {} provider: ".format(api_str),
)
config.routing_table[]
else:
config.api_providers[api_str] = GenericProviderConfig(
provider_id=p,
config=cfg.dict(),
)
if api_str in router_api2builtin_api:
# a routing api, we need to assign it a routing_key and put it in the routing_table
routing_key = prompt(
"> Enter routing key for the {} provider: ".format(api_str),
)
print("")
return config

View file

@ -46,9 +46,9 @@ class MemoryRouter(Memory):
url: Optional[URL] = None,
) -> MemoryBank:
bank_type = config.type
provider = await self.routing_table.get_provider_impl(
bank_type
).create_memory_bank(name, config, url)
bank = await self.routing_table.get_provider_impl(bank_type).create_memory_bank(
name, config, url
)
self.bank_id_to_type[bank.bank_id] = bank_type
return bank

View file

@ -13,21 +13,16 @@ api_providers:
telemetry:
provider_id: meta-reference
config: {}
safety:
provider_id: meta-reference
config:
llama_guard_shield:
model: Llama-Guard-3-8B
excluded_categories: []
disable_input_check: false
disable_output_check: false
prompt_guard_shield:
model: Prompt-Guard-86M
agents:
provider_id: meta-reference
config: {}
provider_routing_table:
inference:
config:
persistence_store:
namespace: null
type: sqlite
db_path: /home/xiyan/.llama/runtime/kvstore.db
routing_tables:
models:
entries:
- routing_key: Meta-Llama3.1-8B-Instruct
provider_id: meta-reference
config:
@ -44,7 +39,21 @@ provider_routing_table:
torch_seed: null
max_seq_len: 4096
max_batch_size: 1
memory:
memory_banks:
entries:
- routing_key: vector
provider_id: meta-reference
config: {}
shields:
entries:
- routing_key: llama_guard_shield
provider_id: meta-reference
config:
model: Llama-Guard-3-8B
excluded_categories: []
disable_input_check: false
disable_output_check: false
- routing_key: prompt_guard_shield
provider_id: meta-reference
config:
model: Prompt-Guard-86M