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

# Analyze For Tuning

> Analyze retriever and generate tuning recommendations.

Performs comprehensive analysis and generates actionable recommendations:
- Parameter tuning suggestions
- Cache optimization opportunities
- Performance improvement estimates

**Recommendations Include:**
- Increase/decrease k value
- Adjust reranking thresholds
- Enable/optimize caching
- Stage reordering suggestions

**Use Cases:**
- Initial retriever configuration
- Periodic performance optimization
- A/B testing parameter changes
- Cost optimization

**Example:**
```bash
curl -X POST "https://api.mixpeek.com/v1/analytics/retrievers/ret_abc123/analyze-tuning?days=7" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Namespace: your-namespace"
```



## OpenAPI

````yaml post /v1/analytics/retrievers/{retriever_id}/analyze-tuning
openapi: 3.1.0
info:
  title: Mixpeek API
  description: >-
    This is the Mixpeek API, providing access to various endpoints for data
    processing and retrieval.
  termsOfService: https://mixpeek.com/terms
  contact:
    name: Mixpeek Support
    url: https://mixpeek.com/contact
    email: info@mixpeek.com
  version: '0.82'
servers:
  - url: https://api.mixpeek.com
    description: Production
security: []
paths:
  /v1/analytics/retrievers/{retriever_id}/analyze-tuning:
    post:
      tags:
        - Analytics
        - Analytics - Retrievers
      summary: Analyze For Tuning
      description: >-
        Analyze retriever and generate tuning recommendations.


        Performs comprehensive analysis and generates actionable
        recommendations:

        - Parameter tuning suggestions

        - Cache optimization opportunities

        - Performance improvement estimates


        **Recommendations Include:**

        - Increase/decrease k value

        - Adjust reranking thresholds

        - Enable/optimize caching

        - Stage reordering suggestions


        **Use Cases:**

        - Initial retriever configuration

        - Periodic performance optimization

        - A/B testing parameter changes

        - Cost optimization


        **Example:**

        ```bash

        curl -X POST
        "https://api.mixpeek.com/v1/analytics/retrievers/ret_abc123/analyze-tuning?days=7"
        \
          -H "Authorization: Bearer YOUR_API_KEY" \
          -H "X-Namespace: your-namespace"
        ```
      operationId: >-
        analyze_for_tuning_v1_analytics_retrievers__retriever_id__analyze_tuning_post
      parameters:
        - name: retriever_id
          in: path
          required: true
          schema:
            type: string
            title: Retriever Id
        - name: days
          in: query
          required: false
          schema:
            type: integer
            maximum: 90
            minimum: 1
            description: Days of history to analyze
            default: 7
            title: Days
          description: Days of history to analyze
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InteractionTuningResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    InteractionTuningResponse:
      properties:
        retriever_id:
          type: string
          title: Retriever Id
          description: Retriever identifier
        analysis_period:
          $ref: '#/components/schemas/api__analytics__models__TimeRange'
          description: Analysis period
        recommendations:
          items:
            $ref: '#/components/schemas/InteractionTuningRecommendation'
          type: array
          title: Recommendations
          description: Tuning recommendations
        current_performance:
          additionalProperties: true
          type: object
          title: Current Performance
          description: Current performance baseline
      type: object
      required:
        - retriever_id
        - analysis_period
        - recommendations
        - current_performance
      title: InteractionTuningResponse
      description: Response for interaction tuning analysis.
      examples:
        - analysis_period:
            end: '2025-10-28T00:00:00Z'
            start: '2025-10-21T00:00:00Z'
          current_performance:
            avg_latency_ms: 145.3
            avg_results: 10
            cache_hit_rate: 0.72
            p95_latency_ms: 287.5
          recommendations:
            - confidence: 0.85
              current_value: 10
              expected_impact: Improve recall by ~15%, increase latency by ~8ms
              reasoning: Query patterns show users often click beyond top 10 results
              recommendation_type: increase_k
              recommended_value: 20
          retriever_id: ret_abc123
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Always false for error responses
          default: false
        status:
          type: integer
          title: Status
          description: HTTP status code for this error
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: Error details payload
      type: object
      required:
        - status
        - error
      title: ErrorResponse
      description: Error response model.
      examples:
        - error:
            details:
              id: ns_123
              resource: namespace
            message: Namespace not found
            type: NotFoundError
          status: 404
          success: false
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    api__analytics__models__TimeRange:
      properties:
        start:
          type: string
          format: date-time
          title: Start
          description: Start time (UTC)
        end:
          type: string
          format: date-time
          title: End
          description: End time (UTC)
      type: object
      required:
        - start
        - end
      title: TimeRange
      description: Time range for analytics queries.
    InteractionTuningRecommendation:
      properties:
        recommendation_type:
          type: string
          title: Recommendation Type
          description: Type of recommendation
          examples:
            - increase_k
            - adjust_rerank_threshold
            - enable_cache
        current_value:
          anyOf:
            - {}
            - type: 'null'
          title: Current Value
          description: Current setting value
        recommended_value:
          title: Recommended Value
          description: Recommended value
        expected_impact:
          type: string
          title: Expected Impact
          description: Expected performance impact
        confidence:
          type: number
          maximum: 1
          minimum: 0
          title: Confidence
          description: Confidence score
        reasoning:
          type: string
          title: Reasoning
          description: Explanation of recommendation
      type: object
      required:
        - recommendation_type
        - recommended_value
        - expected_impact
        - confidence
        - reasoning
      title: InteractionTuningRecommendation
      description: Recommendation for interaction tuning.
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Stable error type identifier (machine-readable)
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            Fine-grained error code for programmatic handling (e.g.,
            namespace_name_taken, feature_extractor_not_found). Present only
            when consumers may need to branch on a specific error condition.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Optional structured details to help debugging (validation errors,
            IDs, etc.)
      type: object
      required:
        - message
        - type
      title: ErrorDetail
      description: Error detail model.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````