Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ api:
# and has a vision-capable model. REQUIRED — edit before first run.
base_url: "https://your-llm-endpoint.example/v1"
model: "your-vision-model-name"
# Sampling temperature for every model call. 0 (the default) gives reproducible
# output, which is what makes "did this change help?" answerable. Raise only if
# you deliberately want variation.
temperature: 0
# OPTIONAL cost estimation. Token usage is always reported; a monetary estimate
# is only added when BOTH prices below are set (per single token — the unit most
# OpenAI-compatible /v1/models endpoints use). Provider-neutral: look up your
Expand Down Expand Up @@ -90,7 +94,7 @@ diagrams:

Strukturera svaret så här:
1. Vad diagrammet visar: titel/ämne och vad x- respektive y-axeln mäter (inklusive enheter).
2. Vilka serier/data: nämn alla serier som visas (linjer, staplar, etc.) och hur de skiljs åt visuellt.
2. Vilka serier/data: nämn alla serier som visas (linjer, staplar, etc.) och hur de skiljs åt visuellt. Beskriv varje serie med hur den utvecklas, helst med konkreta siffror.
3. De viktigaste observationerna: trender, toppar, bottnar, brytpunkter, divergenser. Var konkret med siffror och årtal.
4. Eventuella anmärkningar och källor om de finns med i bilden.

Expand Down
4 changes: 4 additions & 0 deletions src/figmark/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class ApiConfig:
input_token_price: float | None = None
output_token_price: float | None = None
currency: str | None = None
# Sampling temperature for every model call. Defaults to 0 for reproducible
# output — the prerequisite for measuring whether a change helped (T-082).
temperature: float = 0.0


@dataclass
Expand Down Expand Up @@ -214,6 +217,7 @@ def load_config(config_path: str | Path = "config.yaml") -> Config:
input_token_price=in_price,
output_token_price=out_price,
currency=(str(api_raw["currency"]).strip() if api_raw.get("currency") else None),
temperature=float(api_raw.get("temperature", 0.0) or 0.0),
)

input_raw = raw.get("input") or {}
Expand Down
1 change: 1 addition & 0 deletions src/figmark/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def describe_image(
try:
response = client.chat.completions.create(
model=cfg.api.model,
temperature=cfg.api.temperature,
max_tokens=MAX_TOKENS,
messages=[
{
Expand Down
1 change: 1 addition & 0 deletions src/figmark/diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ def describe_diagram(

response = client.chat.completions.create(
model=cfg.api.model,
temperature=cfg.api.temperature,
max_tokens=MAX_TOKENS,
messages=[
{
Expand Down
1 change: 1 addition & 0 deletions src/figmark/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def ocr_page_with_vision(
try:
response = client.chat.completions.create(
model=cfg.api.model,
temperature=cfg.api.temperature,
max_tokens=OCR_MAX_TOKENS,
messages=[
{
Expand Down
2 changes: 2 additions & 0 deletions src/figmark/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def detect_language(client, pages, cfg: Config, cache_path: Path) -> str:

response = client.chat.completions.create(
model=cfg.api.model,
temperature=cfg.api.temperature,
max_tokens=LANG_DETECT_MAX_TOKENS,
messages=[{"role": "user", "content": f"{LANG_DETECT_PROMPT}\n\nText:\n{sample}"}],
)
Expand Down Expand Up @@ -115,6 +116,7 @@ def summarize_document(client, pages, cfg: Config, cache_path: Path, language: s
)
response = client.chat.completions.create(
model=cfg.api.model,
temperature=cfg.api.temperature,
max_tokens=SUMMARY_MAX_TOKENS,
messages=[{"role": "user", "content": user_text}],
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _stub_client(text: str, finish_reason: str = "stop"):


_CFG = SimpleNamespace(
api=SimpleNamespace(model="test-model"),
api=SimpleNamespace(model="test-model", temperature=0.0),
document_summary=SimpleNamespace(sample_words=50, prompt="Summarise."),
)

Expand Down
Loading