Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cyyeh committed Sep 14, 2024
1 parent 40cc2a6 commit d39c41b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions wren-ai-service/src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def lifespan(app: FastAPI):
providers = init_providers(
engine_config=EngineConfig(provider=os.getenv("ENGINE", "wren_ui"))
)
create_service_container(
app.state.service_container = create_service_container(
app,
*providers,
should_force_deploy=bool(os.getenv("SHOULD_FORCE_DEPLOY", "")),
Expand All @@ -64,7 +64,7 @@ async def lifespan(app: FastAPI):
"ttl": int(os.getenv("QUERY_CACHE_TTL") or 120),
},
)
create_service_metadata(app, *providers)
app.state.service_metadata = create_service_metadata(app, *providers)
init_langfuse()

yield
Expand Down
6 changes: 3 additions & 3 deletions wren-ai-service/src/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def create_service_container(
dataset_name="view_questions", recreate_index=True
)

app.state.service_container = ServiceContainer(
return ServiceContainer(
semantics_preparation_service=SemanticsPreparationService(
pipelines={
"indexing": indexing.Indexing(
Expand Down Expand Up @@ -185,7 +185,7 @@ def create_service_metadata(
embedder_provider: EmbedderProvider,
*_,
pyproject_path: str = "pyproject.toml",
):
) -> ServiceMetadata:
def _get_version_from_pyproject() -> str:
with open(pyproject_path, "r") as f:
pyproject = toml.load(f)
Expand All @@ -201,7 +201,7 @@ def _get_version_from_pyproject() -> str:

logger.info(f"Service version: {service_version}")

app.state.service_metadata = ServiceMetadata(models_metadata, service_version)
return ServiceMetadata(models_metadata, service_version)


# Create a dependency that will be used to access the ServiceMetadata
Expand Down

0 comments on commit d39c41b

Please sign in to comment.