Skip to content

chore: rebrand examples from javelin_sdk to highflame#253

Open
safayavatsal wants to merge 2 commits into
highflame-ai:mainfrom
safayavatsal:chore/rebrand-examples
Open

chore: rebrand examples from javelin_sdk to highflame#253
safayavatsal wants to merge 2 commits into
highflame-ai:mainfrom
safayavatsal:chore/rebrand-examples

Conversation

@safayavatsal
Copy link
Copy Markdown

Summary

Mechanical rebrand sweep across all examples/ files to use the v2 SDK surface documented in the README's migration guide. 49 files, 475 insertions / 475 deletions — pure rename, no behavior change.

Closes #242.

What's renamed

  • Imports: javelin_sdk / highflame_sdkhighflame
  • Class names: JavelinClientHighflame, JavelinConfigConfig, JavelinClientErrorClientError
  • Kwargs on Config(...): javelin_api_keyapi_key, javelin_virtualapikeyvirtual_api_key
  • Local variable / function / attr names: javelin_Xhighflame_X (renamed to avoid shadowing the new kwarg names; e.g. local javelin_api_key becomes highflame_api_key so the call site reads Config(api_key=highflame_api_key))
  • Default base URL: api-dev.javelin.liveapi.highflame.app
  • Branding prose in comments, print strings, and notebook markdown cells

What's preserved (intentionally)

  • Compat-shim env-var chains: os.getenv("HIGHFLAME_X") or os.getenv("JAVELIN_X") — these are the documented v1 transition path.
  • x-javelin-* / X-Javelin-* HTTP header names — documented backward-compat headers (dual-emission lives at the SDK transport layer).
  • swagger/sync_models.py's "JavelinConfig" string — load-bearing for backend Swagger sync until the Go-side rename lands (tracked in README's "Backend Changes Required" section).
  • README.md / CLAUDE.md — intentional migration documentation.
  • .js files under examples/ — separate JavaScript SDK rebrand, out of scope.
  • Hosted resource names like javelinpreview.openai.azure.com and javelin-guardrails.fastmcp.app — real DNS entries, not refactor targets.
  • Cached notebook outputs (pip install logs, INFO:httpx traces) — historical execution artifacts; clearing them is a separate concern and would inflate this diff massively.

Type of change

  • Chore (refactoring code, technical debt, workflow improvements)
  • This change requires a documentation update — no, docs already use v2 names

Testing

  • All 60+ modified .py files parse cleanly via ast.parse.
  • All 8 notebooks remain valid JSON.
  • No undefined-name resolution issues across modified files (full repo scan against highflame_api_key, highflame_virtualapikey, javelin_* residuals).
  • flake8 examples/ --select=F841,F821 clean (no unused/undefined locals).
  • No live runtime testing of every example — these are reference snippets, not part of the test suite.

Methodology

Two-pass deterministic substitution script (regex with word-boundary anchors) plus a few hand-curated last-mile fixes for cases the script's lookbehind couldn't disambiguate (e.g. function-local api_key = os.getenv(...) vs javelin_api_key = ... shadowing). The script itself is not committed — it's a one-shot tool.

Risks

  1. Notebook cached outputs still mention Javelin. That's by design — the alternative is clearing notebook outputs, which is a separate maintenance decision and would dwarf the rename diff.
  2. Some examples are duplicative (e.g. multiple OpenAI universal-endpoint examples doing similar things). Consolidation would be a clear win but is outside the scope of this rebrand and should be a separate ticket.
  3. JS files in examples/ are untouched and still carry JAVELIN_* env-var references. These belong to the JavaScript SDK and should rebrand in lockstep with that repo.

Sweeps all Python and notebook files under examples/ to use the v2 SDK
references documented in the README migration guide:

- Imports: javelin_sdk / highflame_sdk -> highflame
- Class names: JavelinClient -> Highflame, JavelinConfig -> Config,
  JavelinClientError -> ClientError
- Kwargs in Config(): javelin_api_key -> api_key,
  javelin_virtualapikey -> virtual_api_key
- Local variable / function names: javelin_X -> highflame_X
  (renamed to avoid shadowing the new kwarg names)
- Default base URL: api-dev.javelin.live -> api.highflame.app
- Branding prose in comments, print strings, and notebook markdown

Preserved (intentionally):
- os.getenv("HIGHFLAME_X") or os.getenv("JAVELIN_X") fallback chains —
  documented v1 compatibility shim
- x-javelin-* / X-Javelin-* HTTP header names — documented backward-compat
  headers
- swagger/sync_models.py "JavelinConfig" string — load-bearing pending
  backend rename (separate ticket)
- README.md / CLAUDE.md — intentional migration docs
- .js files — separate JavaScript SDK
- javelinpreview.openai.azure.com / javelin-guardrails.fastmcp.app —
  actual hosted resources
- Cached notebook outputs (pip install logs, INFO:httpx traces) —
  historical execution artifacts

Verification:
- All 60+ modified .py files parse cleanly via ast.
- All 8 notebooks remain valid JSON.
- No undefined-name resolution issues across modified files.
- flake8 F841 / F821 clean.

Closes highflame-ai#242.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request performs a comprehensive renaming of 'Javelin' to 'Highflame' across various example scripts and notebooks. The review identified several critical NameError bugs where variables were renamed in assignments but not in corresponding conditional checks, which would cause runtime failures. These issues must be addressed to ensure the code functions correctly.

Comment thread examples/agents/crewai_highflame.ipynb Outdated
Comment thread examples/agents/secure_ai_agent.ipynb Outdated
Comment thread examples/openai/openai-azure-fun_calling.ipynb Outdated
Comment thread examples/openai/openai-azure-fun_calling.ipynb Outdated
PR highflame-ai#253 review flagged 4 notebook cells where `api_key = ...` was the
assignment but later references used `highflame_api_key` (NameError at
runtime). A broader scan found 17 affected cells across 8 notebooks —
the bot caught a representative sample.

Root cause: the migration script's kwarg rule
`(?<=[,(\s])javelin_api_key(?=\s*=)` matched module/cell-level
assignments because the lookbehind sees whitespace (including line
start) before the identifier. So javelin_api_key on an assignment
got rewritten to api_key (intended only for kwargs), while later
bare uses got rewritten to highflame_api_key. Inconsistent.

Fix: rename leading-indented `api_key =` / `virtual_api_key =`
assignments in code cells back to `highflame_api_key =` /
`highflame_virtualapikey =` — only in cells that reference the
highflame_* name, so we don't touch cells where api_key is a legitimate
local variable (e.g. OpenAI's own api_key kwarg).

Plus two special cases:
- azure-openai/openai_azureopenai_testing.ipynb cell 12 had no
  highflame_api_key definition at all (pre-existing latent bug exposed
  by rebrand). Added one.
- rag/rag_implemetation_highflame.ipynb cell 7 needed a top-level
  rename (not just indented) since the definition was at module level
  within the cell.

Verification:
- Per-cell AST scan: all references to highflame_api_key /
  highflame_virtualapikey resolve to a definition somewhere in the
  notebook (cross-cell scope model, mirroring jupyter execution).
- All 60+ .py files parse cleanly; flake8 F841/F821 still clean.
@safayavatsal
Copy link
Copy Markdown
Author

Addressed all 4 review comments in 00c135f, plus 13 additional cells the bot didn't flag.

Bot's findings (4 cells): all of the shape "cell defines api_key = os.getenv(...) but later references highflame_api_key" — NameError at runtime.

Root cause: the rebrand script's kwarg rule
(?<=[,(\s])javelin_api_key(?=\s*=) was meant to match only kwarg
positions inside Config(...), but the lookbehind also matches
line-start whitespace, so it rewrote module/cell-level assignments
too. Bare uses elsewhere got the highflame_api_key rename. Result:
defined name and reference name diverged.

Broader scan: I wrote a cross-cell AST name-resolution check
(notebooks share scope across cells, mirroring jupyter execution).
17 cells across 8 notebooks were affected — the bot caught 4
representative ones.

Fix: for each affected cell, rename leading-indented api_key = /
virtual_api_key = assignments back to highflame_api_key = /
highflame_virtualapikey =. Restricted to cells that reference the
highflame_* name, so we don't disturb cells where api_key is a
legitimate local (e.g. OpenAI(api_key=...) patterns).

Special cases handled:

  • azure-openai/openai_azureopenai_testing.ipynb cell 12 had no
    highflame_api_key definition at all — pre-existing latent bug
    surfaced by the rebrand. Added a highflame_api_key = "" placeholder.
  • rag/rag_implemetation_highflame.ipynb cell 7 needed a top-level
    rename (not indented) since the definition was at module level
    within the cell.

Verification:

  • Cross-cell AST scan: zero unresolved highflame_api_key /
    highflame_virtualapikey references across all 8 notebooks.
  • All 60+ .py files still parse cleanly; flake8 F841/F821 clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update examples and documentation

1 participant