meta {
  name: Text Embeddings - Single
  type: http
  seq: 5
}

post {
  url: {{base_url}}/model/{{api_version}}/embed
  body: json
  auth: none
}

headers {
  Content-Type: application/json
  User-Agent: Bruno/1.0
}

body:json {
  {
    "text": "This is a single text string for embedding generation.",
    "input_type": "text"
  }
}

docs {
  # Text Embeddings - Single Text

  Simplified endpoint for testing single text embeddings.
  This is useful for basic testing and debugging.

  ## Request Body

  ```json
  {
    "text": "Single text string",
    "input_type": "text"
  }
  ```

  ## Response

  ```json
  {
    "embeddings": [
      [0.1, 0.2, 0.3, ...]  // Single embedding vector
    ]
  }
  ```

  ## Use Cases
  - Basic functionality testing
  - Single text similarity comparison
  - Quick API validation
  - Debugging and troubleshooting
}

tests {
  test("Status should be 200", function() {
    expect(res.getStatus()).to.equal(200);
  });

  test("Response should contain exactly one embedding", function() {
    const data = res.getBody();
    expect(data.embeddings).to.have.lengthOf(1);
  });

  test("Embedding should be a valid array of numbers", function() {
    const data = res.getBody();
    const embedding = data.embeddings[0];
    expect(embedding).to.be.an('array');
    expect(embedding.length).to.be.greaterThan(0);
    embedding.forEach(value => {
      expect(value).to.be.a('number');
      expect(value).to.be.finite;
    });
  });

  test("Response time should be reasonable", function() {
    expect(res.getResponseTime()).to.be.below(2000);
  });
}
