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

# Interactions

> Track prompts, completions, and feedback

An interaction is a prompt, completion, and any associated feedback or labels. Adaptive logs interactions automatically when you run inference, creating a record you can browse, filter, and use for training.

> [tab] SDK
>
> ## Automatic logging
>
> Inference requests are logged automatically:
>
> ```python theme={null}
> response = adaptive.chat.create(
>     messages=[
>         {"role": "user", "content": "Hello!"}
>     ],
>     labels={"project": "support-bot", "version": "v2"},
> )
> ```
>
> Use `labels` to organize interactions. Labels are key-value pairs for filtering and grouping.
>
> ## Get the completion ID
>
> Extract `completion_id` from the response to log feedback:
>
> ```python theme={null}
> completion_id = response.choices[0].completion_id
> ```
>
> Pass this ID to [Feedback](https://docs.adaptive-ml.com/v0.12/core/feedback.md) methods to associate ratings with the interaction.
>
> ## Manual logging
>
> Log interactions for completions generated outside Adaptive:
>
> ```python theme={null}
> adaptive.interactions.create(
>     model="model_key",
>     messages=[
>         {"role": "system", "content": "You are a helpful assistant."},
>         {"role": "user", "content": "Hello!"}
>     ],
>     completion="Hi there! How can I help you today?",
>     labels={"source": "external"},
> )
> ```
>
> Use manual logging to import historical data or log completions from external models.
>
> > [accordion] Bulk upload with async
> >
> > Upload large datasets efficiently with async concurrency:
> >
> > ```python theme={null}
> > import asyncio
> > from adaptive_sdk import AsyncAdaptive
> >
> > async def upload_data(data: list[dict], labels: dict, max_concurrency: int = 30):
> >     adaptive = AsyncAdaptive(
> >         base_url=os.environ["ADAPTIVE_URL"],
> >         api_key=os.environ["ADAPTIVE_API_KEY"],
> >     )
> >     adaptive.set_default_use_case("my-use-case")
> >
> >     semaphore = asyncio.Semaphore(max_concurrency)
> >
> >     async def upload_one(item):
> >         async with semaphore:
> >             await adaptive.interactions.create(
> >                 messages=item["messages"],
> >                 completion=item["completion"],
> >                 labels=labels,
> >             )
> >
> >     await asyncio.gather(*[upload_one(item) for item in data])
> >
> > # Example data format
> > data = [
> >     {
> >         "messages": [{"role": "user", "content": "Hello!"}],
> >         "completion": "Hi there!"
> >     }
> > ]
> > asyncio.run(upload_data(data, labels={"dataset": "training-v1"}))
> > ```
>
> See [SDK Reference](https://docs.adaptive-ml.com/v0.12/reference/sdk.md) for all interaction methods.

> [tab] UI
>
> ## Browse interactions
>
> Navigate to your use case and open the **Interactions** tab to view logged data.
>
> Filter by label, time range, or feedback values to find specific interactions. Click any row to see the full prompt and completion.
>
> Use interactions to:
>
> * Audit model responses
> * Find examples for training datasets
> * Debug unexpected behavior


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.