End-to-end demo using the bundled mock providers (no credentials needed).
()
| 385 | |
| 386 | @app.command() |
| 387 | def demo() -> None: |
| 388 | """End-to-end demo using the bundled mock providers (no credentials needed).""" |
| 389 | os.environ.setdefault("PAPERFLOW_LLM_PROVIDER", "mock") |
| 390 | os.environ.setdefault("PAPERFLOW_EMBED_PROVIDER", "hash") |
| 391 | |
| 392 | config = load_provider_config() |
| 393 | typer.echo("PaperFlow demo (deterministic, offline)") |
| 394 | typer.echo(f"Providers: {config.describe()}") |
| 395 | |
| 396 | llm = build_llm_provider(config) |
| 397 | embed = build_embedding_provider(config) |
| 398 | |
| 399 | response = llm.generate( |
| 400 | "Summarize PaperFlow in one sentence.", |
| 401 | system="You are a concise research assistant.", |
| 402 | ) |
| 403 | typer.echo(f"\n[llm:{llm.name}:{llm.model}] {response.text}") |
| 404 | |
| 405 | sample_texts = [ |
| 406 | "Personalized paper recommendation with interest drift.", |
| 407 | "Multi-modal foundation models for scientific discovery.", |
| 408 | "Reinforcement learning from human feedback.", |
| 409 | ] |
| 410 | vectors = embed.embed_batch(sample_texts) |
| 411 | typer.echo(f"\n[embed:{embed.name}:{embed.model}] dim={embed.dimensions} batch={len(vectors)}") |
| 412 | for text, vector in zip(sample_texts, vectors): |
| 413 | preview = ", ".join(f"{value:+.3f}" for value in vector[:5]) |
| 414 | typer.echo(f" - {text[:60]:<60} -> [{preview}, ...]") |
| 415 | |
| 416 | |
| 417 | @app.command() |
nothing calls this directly
no test coverage detected