Commit Graph

274 Commits

Author SHA1 Message Date
Kiewan Villatel 32192ca3e1 Build SDK
Stainless-Generated-From: fa9e9cd4cf1e6fa524a69184c0fbaba61eae1556
2026-07-31 18:41:49 +02:00
stlc-bot 8abc50af55 docs(feedback): document session_id as required on feedback creation
Stainless-Generated-From: 111b7da5b320b1dfa13b0d1ced36a9d0ba2c43ef
2026-07-30 11:28:49 +00:00
Emil Filipov 714a32cc62 fix(evaluation): don't post comparative feedback without a session_id (#52)
`logComparativeEvaluationFeedback` looked each run up by the keys of the
score map
returned by the user's comparative evaluator, but posted the feedback
whether or not
the lookup hit. On a miss, `POST /api/v1/feedback` went out with a
`run_id` but no
`session_id` — while still carrying this comparison's
`comparative_experiment_id` and
`feedback_group_id`. `ComparisonEvaluationResult.scores` is authored
entirely by the
evaluator and was never checked against the runs it was handed, so a
nested run id, or
one an LLM judge invented, was enough to trigger it.

Such an entry is now skipped with a `WARNING`, and `.sessionId(...)` is
unconditional in
the builder. No fallback session is used: with two experiments in play
there is no way to
tell which one an unrecognised run belongs to. Evaluator-supplied text
is sanitized before
logging so a judge's output can't forge log records.

The other feedback paths were checked and are unaffected — `evaluate()`
supplies
`session_id` via `TraceConfig`, and `evaluateExisting()` via the
required
`RunSchema.session_id`.

New `EvaluateSupportTest` calls the internal helper directly with a
mocked
`FeedbackService`. This path had no coverage before.

## Test Plan

- [x] `./gradlew :langsmith-java-core:test` green (422 test classes);
`lintKotlin` clean
2026-07-30 13:02:06 +02:00
KiewanVillatel 383fbdb431 fix: strip a trailing /api or /api/v1 from the configured base URL (#51)
## Summary

Port of langchain-ai/langsmith-sdk#3284 to the Java SDK. There was no
stripping here at all, so this implements it.

The generated request paths spell their own prefix out —
`RunServiceImpl` emits `.addPathSegments("api", "v1", "runs", "query")`,
`.addPathSegments("v2", "runs", "query")` — so for those the base URL
has to point at the deployment root. A user who sets
`LANGSMITH_ENDPOINT` to the suffixed URL the Python and JS SDKs accept
(`https://host/api/v1`) currently gets requests to
`https://host/api/v1/api/v1/runs/query`.

Handwritten requests are the opposite case: they are root-relative, so
the prefix they sit behind comes from the configured endpoint — `/api`
on self-hosted, nothing on SaaS. That is deployment specific and cannot
be reconstructed from a normalized root, so those requests keep the URL
exactly as configured.

## Which requests are handwritten

Determined with `make show-custom-code TARGET=java` in
`langchainplus/smith-sdks`, which diffs pure generated output against
the integrated SDK. Only two endpoint families build a URL from the
client base URL outside the generated paths:

| Handwritten request | Files |
|---|---|
| `GET {base}/info` | `InfoServiceImpl`, `InfoServiceAsyncImpl` |
| `POST {base}/runs/multipart` | `RunServiceImpl`, `RunServiceAsyncImpl`
|

`AutoBatchQueue`, `RunMultipartBatch`, `RunCompression` and
`evaluation/*` are custom but route through those or through generated
methods. `OtelTraceExporter` uses its own OTLP endpoint. The one other
handwritten request, the OAuth token refresh in `ProfileConfig`,
deliberately targets the root and already stripped `/api/v1`.

## Changes

- **`BaseUrls.kt`** (new, custom) — `normalizeBaseUrl` trims a trailing
`/api/v1` or `/api`. Only whole trailing path segments of the *parsed*
URL are considered, so a host such as `api.example.com` is untouched and
the scheme/host are never rewritten. The result keeps a trailing slash,
matching `ClientOptions.PRODUCTION_URL`. A URL that fails to parse, or
that carries a query or fragment, is returned unchanged. A bare `/v1` is
not stripped, matching the Python and JS SDKs.
- **`ClientOptions.kt`** — `baseUrl()` now returns the normalized root,
and a new `configuredBaseUrl()` returns the value as configured.
Normalizing in the **getter** rather than in `Builder.baseUrl` matters:
it keeps the configured value recoverable, including across a
`toBuilder()` round trip.
- **The four handwritten call sites** — switched to
`clientOptions.configuredBaseUrl()`.
- **`ProfileConfig.kt`** — `normalizeConfigUrl` delegates to the shared
helper, so the OAuth token endpoint strips `/api` too rather than only
`/api/v1`.

`PrepareRequest.kt` carries no custom code, so it is left untouched.

## Tests

New custom `BaseUrlsTest.kt` (the generated `ClientOptionsTest.kt` is
left alone), 21 tests: the stripped and preserved cases for
`normalizeBaseUrl`; handwritten `/info` and `/runs/multipart` keeping
the configured URL for endpoints of `""`, `/api` and `/api/v1`;
generated paths resolving against the root in all three; both accessors
on `ClientOptions`; the `toBuilder()` round trip; and the null fallback
to `PRODUCTION_URL`.

- `./gradlew :langsmith-java-core:test` → 1986 tests, 0 failures
- `./gradlew format` / `lint` clean

Note: `AutoBatchQueueTest.batch size limit starts a new batch for
subsequent runs` is timing sensitive and fails intermittently when run
in isolation, on a clean `main` checkout as well as here. Unrelated to
this change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 10:19:21 +02:00
stlc-bot 02b1bda78f fix(annotation-queues): document item endpoints at their served path
Stainless-Generated-From: 10b633a9e465beaf23af76f9aa3b5ff84c2eca74
2026-07-30 03:21:13 +00:00
stlc-bot 553547325f feat(smith-go): declare v2 endpoints under /api/v2 in the OpenAPI spec
Stainless-Generated-From: 748b608f92cf157c589ab2ee8519c1420b0a93e7
2026-07-29 23:06:21 +00:00
stlc-bot 02f1aeb12c feat(annotation-queues): rename items wire field session_id to project_id
Stainless-Generated-From: d8ce7475f1c53e5168838114f442e164c1b41861
2026-07-29 21:38:42 +00:00
stlc-bot 3d2ec89e04 fix(evaluators): show an evaluator's current name wherever it's attached [LSE-2687]
Stainless-Generated-From: 0cd00faa550590ce050dec54af177d6966f0524b
2026-07-29 20:39:21 +00:00
stlc-bot b922c8e220 fix(runs): restore optional session on public dataset stats endpoint
Stainless-Generated-From: 76dd0b0d5956a552fb8cd7a66c74b7ffb56cbcc6
2026-07-29 18:07:10 +00:00
stlc-bot 2c5d0dcd28 fix: remove internal annotation queue API docs
Stainless-Generated-From: eca75e0aa426da2c8f1192558f02df067eb1f7cc
2026-07-28 21:51:32 +00:00
stlc-bot 2fdc70b11a feat: expose annotation queue item APIs publicly [LSE-2550]
Stainless-Generated-From: 398b0fdecf4307af3af7cea4f223d52f9dc1919f
2026-07-27 22:57:12 +00:00
stlc-bot fd6269b865 fix(threads): make trace_id in list_traces respect the selects contract
Stainless-Generated-From: 08a82813d828aeeebf42e3a08245aec3769b29a7
2026-07-27 08:20:34 +00:00
stlc-bot 06cdab2519 feat(backend): allow storing markdown / text blocks as charts in /v1/charts/{...} endpoints
Stainless-Generated-From: e81011bfc58ba311ddea07863c252a3e872dba12
2026-07-25 00:53:27 +00:00
stlc-bot 3d6f9eb532 chore(info): remove legacy Python /info endpoint, serve from smith-go
Stainless-Generated-From: 992d75ad1ceef103593fd9b00d7994097a43e46a
2026-07-24 14:51:44 +00:00
stlc-bot aece72d035 refactor(runs): remove SmithDB v2 endpoint flag [LSO-3391]
Stainless-Generated-From: eaf6eeeffa6089b29a6ed890ffccada85c435446
2026-07-23 00:21:12 +00:00
stlc-bot aa4be05c11 feat(backend): update CRUD endpoint to allow retrieving / storing chart series metadata
Stainless-Generated-From: d6a6962cef9066a8de2683d0a48553057474595b
2026-07-22 19:30:16 +00:00
stlc-bot 8aded40800 feat(backend): Allow storing grid layout to custom dashboards
Stainless-Generated-From: 235750773cea09074a5f805563dba096b19f5c6a
2026-07-22 18:27:41 +00:00
stlc-bot 6165434d21 feat(sandboxes): free-form labels on sandboxes and snapshots
Stainless-Generated-From: 5a8ad04cc2a2a4afaa4f310a862d9701806a1662
2026-07-22 14:07:11 +00:00
stlc-bot 95da1e9b94 revert(runs): require session in POST /runs/stats
Stainless-Generated-From: 76e29824c8418e6e3596ff4fde3f2abec3fd34f9
2026-07-22 12:49:59 +00:00
stlc-bot eace8c3f99 feat(sandboxes): let proxy rules contribute sandbox env vars
Stainless-Generated-From: 3d4147438f77389052680dd6bf85a9c90ab4d373
2026-07-22 10:42:41 +00:00
stlc-bot 056dbd3673 fix(runs): require session in POST /runs/stats
Stainless-Generated-From: b24d4f534d67323bbf8765d82bb0843c24030da5
2026-07-22 10:25:34 +00:00
stlc-bot e7fe407f74 fix: support last_queued_at in v2 runs query
Stainless-Generated-From: da0d737eda0ece655bc0779537309b706951bb74
2026-07-21 23:20:53 +00:00
stlc-bot f6608288d4 feat(host): p50/p99 run queue wait-time chart in project monitoring [LSD-1547]
Stainless-Generated-From: 17fb5d12f51ab1746f996098443e5b69b023ca82
2026-07-21 20:22:16 +00:00
stlc-bot b072b2e2fc fix(evaluators): persist and wire through playground_settings_id for llm-as-judge oauth models [part of ENT-1402]
Stainless-Generated-From: 809ff1ccff334354d5ce4e55c50e5f4974bcf13f
2026-07-21 15:57:35 +00:00
stlc-bot 57da309643 feat(runs): add GET /v2/runs/{run_id}/url endpoint and SDK runs.get_url method
Stainless-Generated-From: 12ef224c44ef834db59a6216eb1010f87947b165
2026-07-20 10:12:06 +00:00
stlc-bot 101472f4ce feat(runs/v2): make start_time optional in GET /v2/runs/:id
Stainless-Generated-From: fc698ee51e0e6b4b1cb0389217ce572774ac2dba
2026-07-17 17:39:28 +00:00
stlc-bot 2f1ca870dd docs: minor rewording of List Commits endpoint description
Stainless-Generated-From: cfaab39cb776a2dff32d8108ebd8c219682c0d92
2026-07-17 09:29:49 +00:00
stlc-bot 1409dd89d8 fix: remove July 2026 premier plan
Stainless-Generated-From: 09c5b50a463efb9be1cd10176e2bc88fd9e2fc4a
2026-07-16 22:11:59 +00:00
stlc-bot 839107858c chore: new unshare endpoint that doesn't require lookup
Stainless-Generated-From: 3c2f57d95968959d58e0bafbea6a5d0b24077e75
2026-07-16 21:51:34 +00:00
stlc-bot 8eb067064e fix(datasets): serve public dataset sessions via Go, fixing SmithDB-only 501
Stainless-Generated-From: cbd1d7df666a4e821e8ac118fd84eaa8e5acdb00
2026-07-16 16:24:08 +00:00
stlc-bot 306a079479 chore: Stainless SDK methods for V2 public-run APIs
Stainless-Generated-From: 0c767292f9a7937b0d09cb8261ae2c873a41ce2d
2026-07-16 15:15:00 +00:00
stlc-bot 50525423cc feat(feedback): support GET /feedback for thread AQs
Stainless-Generated-From: 50cfa58b8547d1cd99da2b22d9081517d3cbbf92
2026-07-15 18:50:28 +00:00
stlc-bot d53da42ffa feat: add run rule evaluator tracing flag [LSO-3323]
Stainless-Generated-From: df568b7188e650a63d7521cb0b0321fc4332db75
2026-07-15 17:01:02 +00:00
stlc-bot cbc00807ee feat(engine): issue lifecycle backend + webhook status filter (2/8)
Stainless-Generated-From: c6ff8a64c58e6a3d43bf068dd92639cc39e2aa0b
2026-07-15 16:42:11 +00:00
stlc-bot d35ada22c7 chore: update smithdb proto generated code
Stainless-Generated-From: 2945c07633971e09ac433ae6fac86ff1d3695ed1
2026-07-14 23:17:38 +00:00
stlc-bot 2c9704f3c0 feat(context-hub): fire commit webhook and deliver async
Stainless-Generated-From: c28c9c538349263a012361131369c1a2892b246b
2026-07-14 17:46:20 +00:00
stlc-bot b2ed882d0e feat: add July 2026 startup and premier plan tiers
Stainless-Generated-From: 5cd04e44b56fb36e6ec5b7d431198df237532e00
2026-07-14 17:04:24 +00:00
stlc-bot 99fe7dbe33 feat(sandboxes): add preserve_memory_on_stop create attribute
Stainless-Generated-From: c005594f452b7d91aad0d624bc9ebbbef0d8d692
2026-07-14 12:58:43 +00:00
John Kennedy e639046090 fix: patch remaining Java security alerts (#38)
## Summary

Patch the remaining open Java/Maven Dependabot alerts on the Stainless
next branch.

## Changes

- Upgrade Jackson modules from 2.22.0 to 2.22.1.
- Pin vulnerable test dependencies to patched versions:
  - Bouncy Castle modules: 1.84
  - Log4j Core: 2.25.4
  - Plexus Utils: 4.0.3
  - Commons Lang: 3.18.0
- Use explicit versions for the test dependencies so the dependency
graph recognizes the fixes.

## Security Alerts

Resolves the affected alerts for Jackson Databind/Core, Bouncy Castle,
Log4j Core, Plexus Utils, and Commons Lang, including:

- GHSA-5jmj-h7xm-6q6v
- GHSA-5hh8-q8hv-fr38
- GHSA-9fxm-vc8v-hj55
- GHSA-hgj6-7826-r7m5
- GHSA-rmj7-2vxq-3g9f
- GHSA-j3rv-43j4-c7qm
- GHSA-rcqc-6cw3-h962
- GHSA-cj8j-37rh-8475
- GHSA-c3fc-8qff-9hwx
- GHSA-wg6q-6289-32hp
- GHSA-445c-vh5m-36rj
- GHSA-6hg6-v5c8-fphq
- GHSA-3pxv-7cmr-fjr4
- GHSA-vc5p-v9hr-52mj
- GHSA-6fmv-xxpf-w3cw
- GHSA-72hv-8253-57qq

## Verification

- Core test suite passed.
- Kotlin formatting passed.
- Gradle dependency resolution confirms Jackson Databind 2.22.1.
- Diff check passed.
2026-07-14 01:56:47 -07:00
stlc-bot 1893f83cf2 fix(smith-sdks): name thread stats response model ThreadStats
Stainless-Generated-From: 08528562024b8bc13c762ccb8a943824136e51ab
2026-07-14 08:05:19 +00:00
stlc-bot 63bde3c6e4 fix(smith-go): default time bounds for POST /v2/threads/query
Stainless-Generated-From: 0fe434729c46373eaa6f2c4fcba16fa6b674e9c6
2026-07-13 16:27:40 +00:00
stlc-bot 9cfd26bef9 refactor(sandboxes): make context hub sync a generic mount
Stainless-Generated-From: 8d75a97626cfea68319b3656b34756d2a0100b30
2026-07-12 22:00:12 +00:00
stlc-bot 17551decf7 feat(evaluators): expose is_managed on Go evaluator reads [LSE-2532]
Stainless-Generated-From: 4fdcf56badac7a5800d4d83afc3fdbde1fe3d09e
2026-07-10 19:00:10 +00:00
stlc-bot 0a29041897 feat(dashboards): convert prebuilts to v2 charts on clone [LSO-3306, LSO-3322]
Stainless-Generated-From: 9a6d3abdfd5cd0109e650ac59f56cbd95ff275f2
2026-07-10 16:03:05 +00:00
stlc-bot 12185beb4c feat: forward filter param to thread stats API
Stainless-Generated-From: b4b2f4867f918b220c363931b43145dbeeea5b07
2026-07-09 22:28:22 +00:00
stlc-bot 18d7867206 feat(sdk): wire annotation-queue runs/by-key into stainless [LSAQ-141]
Stainless-Generated-From: a2b46fa9a70c37b435ed42d063f79de82478c6ed
2026-07-09 21:49:37 +00:00
stlc-bot 59d3e33e71 docs(runs): document that limit does not apply when querying by trace ID
Stainless-Generated-From: d8187437e161077c4005caca7dc16759de02a5e0
2026-07-08 18:40:44 +00:00
Jacob Lee 13b36e3f11 feat: Adds attachment support to Java multipart requests (#33)
Adds multipart run attachment support to the Java SDK.

- Added `RunAttachment` for binary run attachments.
- Added per-run attachments on `Run`.
- Added direct multipart ingest APIs:
  - `client.runs().multipartIngest(createRuns, updateRuns)`
  - async/raw response variants
- Multipart serialization now sends:
  - run payloads as `post.{runId}` / `patch.{runId}`
  - large fields separately, e.g. `post.{runId}.inputs`
  - attachments as `attachment.{runId}.{attachmentName}`
- `InputStream` attachments are treated as non-repeatable so retry
behavior is safe.

Java:
```java
import com.langchain.smith.client.okhttp.LangsmithOkHttpClient;
import com.langchain.smith.models.runs.Run;
import com.langchain.smith.models.runs.RunAttachment;

import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.UUID;

public class MultipartRunAttachmentExample {
    public static void main(String[] args) {
        var client = LangsmithOkHttpClient.builder()
            .apiKey(System.getenv("LANGSMITH_API_KEY"))
            .build();

        var runId = UUID.randomUUID().toString();

        var run = Run.builder()
            .id(runId)
            .traceId(runId)
            .dottedOrder("20250101T000000000Z" + runId)
            .name("run-with-attachment")
            .runType(Run.RunType.CHAIN)
            .putAttachment(
                "input-file",
                RunAttachment.of(
                    "text/plain",
                    "hello from an attachment".getBytes(StandardCharsets.UTF_8)
                )
            )
            .build();

        client.runs().multipartIngest(List.of(run), List.of());

        client.close();
    }
}
```

Kotlin:

```kotlin
var runId = UUID.randomUUID().toString();

var run = Run.builder()
    .id(runId)
    .traceId(runId)
    .dottedOrder("20250101T000000000Z" + runId)
    .name("run-with-attachment")
    .runType(Run.RunType.CHAIN)
    .putAttachment(
        "input-file",
        RunAttachment.of(
            "text/plain",
            "hello from an attachment".getBytes(StandardCharsets.UTF_8)
        )
    )
    .build();

client.runs().multipartIngest(List.of(run), List.of());
```
2026-07-07 15:56:59 -07:00
stlc-bot fcc7ab733b feat(backend): extend_trace_retention field for annotation queue adds
Stainless-Generated-From: 6e5f8b8939ccbe3b430dcd2e24d162f1a2a9cd1c
2026-07-07 17:54:22 +00:00
stlc-bot a07babf48b refactor(sandboxes): resolve default sandbox via snapshot tag instead of blueprint
Stainless-Generated-From: 543ad09db4e939e4c6fac45a471bdbf33106b7f5
2026-07-07 17:32:58 +00:00