> ## Documentation Index
> Fetch the complete documentation index at: https://www.adaline.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# LogSpanRetrievalContent

> Span content type for RAG retrieval and vector search operations.

# LogSpanRetrievalContent

Span content for retrieval operations. Use this type when logging RAG (Retrieval-Augmented Generation) queries — vector similarity searches, keyword lookups, or any step that fetches context documents before passing them to an LLM.

## Import

```typescript theme={null}
import type { LogSpanRetrievalContent } from '@adaline/api';
import { LogSpanRetrievalContentTypeEnum } from '@adaline/api';
```

## Type Definition

```typescript theme={null}
interface LogSpanRetrievalContent {
  type: 'Retrieval';
  input: string;                   // JSON string (must be valid JSON)
  output: string;                  // JSON string (must be valid JSON)
}
```

## Properties

* `type` - Discriminator field, always `'Retrieval'` for this content type
* `input` - The retrieval query as a JSON string (`JSON.stringify()` of the search parameters)
* `output` - The retrieved results as a JSON string (`JSON.stringify()` of the documents/chunks)

Both `input` and `output` must be valid, parseable JSON strings (the result of `JSON.stringify()`). Passing a plain string that isn't valid JSON will cause the span to be rejected.

***

## Example

```typescript theme={null}
async function searchDocuments(query: string, topK: number) {
  const res = await vectorStore.similaritySearch(query, topK);
  return res;
}

const input = { query: 'How do I configure SSO?', topK: 5, namespace: 'docs' };
const results = await searchDocuments(input.query, input.topK);

span.update({
  content: {
    type: 'Retrieval',
    input: JSON.stringify(input),
    output: JSON.stringify(results),
  },
});
```

***

## Related

* [LogSpanContent](/docs/reference/sdk/v2/typescript/types/LogSpanContent) — union type that includes `LogSpanRetrievalContent`
* [LogSpanEmbeddingsContent](/docs/reference/sdk/v2/typescript/types/LogSpanEmbeddingsContent) — often used before retrieval to generate query embeddings
* [Span](/docs/reference/sdk/v2/typescript/classes/span) — class that accepts `LogSpanContent` via `span.update()`
