Skip to content

Add client.embeddings.create() for /v1/embeddings endpoint #10

@flyworker

Description

@flyworker

Context

mega-nova-api is adding POST /v1/embeddings (MeganovaAI/mega-nova-api#441). The SDK needs a matching client method.

Requirements

  • Create meganova/resources/embeddings.py with EmbeddingsResource
  • Add client.embeddings.create() method
  • Support parameters: input (str or list[str]), model, encoding_format
  • Create Pydantic models in models/embeddings.py:
    • Embedding(index, embedding: list[float], object)
    • EmbeddingResponse(data: list[Embedding], model, usage)
  • Wire into main MegaNova client class
  • Add example: examples/embeddings.py

Interface

# Match OpenAI SDK pattern:
response = client.embeddings.create(
    input="Hello world",
    model="meganova-ai/embedding-v1"
)
print(response.data[0].embedding[:5])  # [0.123, -0.456, ...]

Depends On

  • mega-nova-api#441 (embeddings endpoint implementation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready for testImplementation complete, ready for QA testing

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions