Skip to content

Commit

Permalink
Revert #765 (#778)
Browse files Browse the repository at this point in the history
Revert #765

Revert #765 to fix properly in the AIConfig SDK
  • Loading branch information
saqadri authored Jan 5, 2024
2 parents d63d78d + b7a46a2 commit 1f9b02a
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions python/src/aiconfig/editor/server/server_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@ def init_server_state(app: Flask, edit_config: EditServerConfig) -> Result[None,
return Err(f"Failed to load AIConfig from {edit_config.aiconfig_path}: {e}")
else:
LOGGER.info(f"Creating new AIConfig at {edit_config.aiconfig_path}")
aiconfig_runtime = _create_new_aiconfig()
aiconfig_runtime = AIConfigRuntime.create() # type: ignore
model_ids = ModelParserRegistry.parser_ids()
aiconfig_runtime.add_prompt("prompt_1", Prompt(name="prompt_1", input="", metadata=PromptMetadata(model=model_ids[0])))
if len(model_ids) > 0:
aiconfig_runtime.add_prompt("prompt_1", Prompt(name="prompt_1", input="", metadata=PromptMetadata(model=model_ids[0])))

state.aiconfig = aiconfig_runtime
LOGGER.info("Created new AIConfig")
Expand All @@ -235,20 +236,6 @@ def init_server_state(app: Flask, edit_config: EditServerConfig) -> Result[None,
return core_utils.ErrWithTraceback(e)


def _create_new_aiconfig() -> AIConfigRuntime:
aiconfig_runtime = AIConfigRuntime.create() # type: ignore
model_ids = ModelParserRegistry.parser_ids()
if len(model_ids) > 0:
LOGGER.info(f"{model_ids=}")
for model_id in model_ids:
if aiconfig_runtime.metadata.models is None:
aiconfig_runtime.metadata.models = {}
if model_id not in aiconfig_runtime.metadata.models:
aiconfig_runtime.add_model(model_id, {"model": model_id})

return aiconfig_runtime


def _safe_run_aiconfig_method(aiconfig: AIConfigRuntime, method_name: MethodName, method_args: OpArgs) -> Result[None, str]:
# TODO: use `out`
try:
Expand Down

0 comments on commit 1f9b02a

Please sign in to comment.