User guide

User guide

nbinlineai puts AI questions and answers beside your code in a JupyterLab notebook. Ask about selected notebook text, refer to a live Python value, or offer a function for the AI to call. Questions and answers stay as editable Markdown cells, so you can read, correct, and share the conversation with your work.

START HERE: Open the starter tools tutorial to insert the 19 default tool declarations and use selected tools. Copy its editable notebook, run its setup, and try the AI questions with your connection. The five questions include real saved answers and tool tables; follow the fresh-run instructions to repeat them. You will inspect disposable files, a saved notebook, and live unsaved cells, then review an inserted Markdown note and code draft.

Start with one question

  1. Install and connect. In Configure AI, connect your ChatGPT subscription or an API provider, then choose the connection for this notebook.
  2. Open the Quick start notebook and run its Python setup. Read its saved examples before trying your own question.
  3. Select a cell and click + AI Prompt. Write a question, choose Compact for a concise answer, and press Run AI or Shift+Enter. The answer appears in a paired cell below.
  4. To continue the conversation, add another AI question below the answer. To replace an answer, turn off that question’s Keep answer, edit the question, and rerun it.

The AI defaults row sets this notebook’s connection, model, style, and effort. A question’s Override changes those choices for that question. Changing settings does not rewrite an answer you already have.

Choose what the AI can use

Choose what the AI can read or do:

You want the AI to… How to provide it
Read code or notes Choose notebook Context. Default starts with eligible cells above the question. Preview the selection in Details.
Read a live Python value Put a reference such as $`score` in the current question, after running the code that defines it.
Call a function Import or define the function in Python, then declare it with a reference such as &`show_doc` in the question or an earlier Markdown note with Tools enabled.
See an image Use attach_media and confirm the exact image for that question, then run the question with an image-capable model. A displayed plot alone is not sent.

Context describes notebook text; a live value describes the kernel now. They can differ if you edited code without rerunning it. Tool declarations remain available even when the note declaring them is excluded from text context. Read Context and Live values and tools when these distinctions matter.

The Tool catalog gives each tool a normal-use example and an AI example. Most tools can be called directly in Python. To change the open notebook with insert_code, offer it to an AI question and ask for the insertion. Review the new code cell before you run it. The complete notebook catalog links readable pages and editable sources.

To see several tools work together, start with the five complete application notebooks. The application guide explains how captures become Python values and how a staged AI conversation creates a presentation or report. The notebook audit describes the audited notebooks’ saved outcomes and limitations.

For a first worked tool call, open Live Python inspection. Compare the saved Python result with the AI question, its answer, and the observed-tool table beside it. Then open a copy of the notebook and run its setup before trying the question yourself. The browser-media foundation notebook uses the same pattern for an operation that returns a receipt.

Understand browser receipts before using media tools

Camera capture, recording, importing, playback, and other browser operations can continue after their Python call returns. The return value is a BrowserReceipt, a live record of the operation rather than its finished image or clip.

Work through three steps:

  1. Start. Run from nbinlineai.tools import browser_capabilities and then receipt = browser_capabilities() in a code cell. Let that cell finish.
  2. Inspect later. In another cell, read receipt.status, receipt.result, and receipt.error. The same receipt updates as the browser works. Its first printed value is only a snapshot.
  3. Use the result. Continue with dependent work when receipt.status is completed. For a capture, this can mean displaying the returned image or clip; for a save, checking the saved media descriptor.

For interactive operations, use the browser’s permission dialog, chooser, or Media row as directed. waiting_for_user, running, paused, and saving all mean there is more to do. A failed, cancelled, or expired receipt is finished without a successful result; read its error before retrying.

An AI tool call receives a snapshot, not that changing Python object. If it starts an operation and returns an operation ID, finish the visible action and use a later AI question to call operation_status for that ID. An initial acknowledgement does not establish that a photo exists or a file was saved.

Read the status inside the operation_status result. The lookup itself can complete while the operation it describes is still running. Use a source ID or captured media only after the target operation reports completed. stale_target means that the original notebook, session, or referenced item changed or is unavailable. If the result says expired or stale_target, start a new operation in the current notebook session.

The Browser media receipts guide shows a complete save-and-inspect example, explains the fields and status lookups, and covers cancellation and cleanup. Receipts to real Python values continues from a finished receipt to a Pillow image or encoded clip. Then choose camera and recording, notebook outputs, import and playback, transformations, or image attachments.

Run and save deliberately

Run All includes AI questions, respecting their Keep choices. It waits for each AI request, but a request can finish after starting a browser operation that is still running. It also does not turn a Python receipt into a wait for the browser. Run interactive media calls and their dependent inspection cells separately.

Saved answers and code outputs let you read a worked notebook without repeating its actions. They do not recreate Python variables, open a camera, or restore a recording session. After a kernel restart, rerun setup; deliberately rerun any AI action you need again. Keeping an answer preserves its text and skips its tool calls.

Save the notebook to retain questions, answers, and outputs. Save media separately when you want a reusable file. Capturing or previewing media does not automatically send it to the model; explicit attachment gives you that choice.

Read the chapters you need

  1. Install and connect covers installing the extension, connecting ChatGPT or an API key, and understanding account limits.
  2. Write and run AI questions covers creating prompts, continuing conversations, copying code, and requesting a new code cell.
  3. Models, styles, and effort covers choosing providers and models, customizing response styles, and setting thinking effort.
  4. Edit, rerun, and run notebooks covers correcting answers, using Keep answer, and running a whole notebook safely.
  5. Choose notebook context covers selecting cells and tools, previewing what fits, and comparing OpenAI API, Claude API, and ChatGPT context budgets.
  6. Live values and tools covers referencing kernel values and offering Python functions and bundled notebook tools.
  7. Saved notebooks and privacy covers saved AI cells, key storage, account state, and the request path.
  8. Troubleshooting and limits covers resolving common problems and checking size and tool-round limits.

The FAQ covers common questions about receipts, Run All, context, connections, and saved work.