Load ANTHROPIC_API_KEY from env and show clear error when missing
Browse filesFiles changed (2)
21 unmodified lines22232425262721 unmodified linesreturn self._parse_with_llm(text)def _parse_with_llm(self, text: str) -> ArchitectureModel:try:import anthropicexcept ImportError:21 unmodified lines22232425262728293031323321 unmodified linesreturn self._parse_with_llm(text)def _parse_with_llm(self, text: str) -> ArchitectureModel:import osif not os.getenv("ANTHROPIC_API_KEY"):raise ValueError("Text analysis requires an Anthropic API key. ""Set ANTHROPIC_API_KEY in your environment or use the file upload option instead.")try:import anthropicexcept ImportError:
12345678910"""ArchLens FastAPI web server."""from __future__ import annotationsimport tempfilefrom pathlib import Pathfrom typing import Optionalfrom fastapi import FastAPI, File, Form, UploadFile, HTTPExceptionfrom fastapi.responses import HTMLResponsefrom fastapi.staticfiles import StaticFiles123456789101112131415"""ArchLens FastAPI web server."""from __future__ import annotationsimport osimport tempfilefrom pathlib import Pathfrom typing import Optional# Allow HF Spaces / Docker to inject the key via environment variableif os.getenv("ANTHROPIC_API_KEY"):os.environ["ANTHROPIC_API_KEY"] = os.getenv("ANTHROPIC_API_KEY")from fastapi import FastAPI, File, Form, UploadFile, HTTPExceptionfrom fastapi.responses import HTMLResponsefrom fastapi.staticfiles import StaticFiles
archlens/parsers/text.py+6
web/app.py+5