Skip to content

Conversation

@ahmed-bhs
Copy link
Contributor

Q A
Bug fix No
New feature Yes
BC No
License MIT

Adds api_key and url parameters to embed.model_config, enabling the use of custom embedding services (Ollama, OpenAI, local models) instead of being limited to Typesense
Cloud models.

Usage Example

embeddings:
    type: float[]
    embed:
        from: [title, description]
        model_config:
            model_name: 'openai/nomic-embed-text'
            url: 'http://ollama:11434'
            api_key: 'optional-key'  # Optional
``

Allows using OpenAI-compatible APIs (Ollama, custom models)
instead of only Typesense Cloud models for embeddings.
Validates that api_key and url parameters are properly accepted
in embed.model_config without throwing exceptions.
'token_separators' => $config['token_separators'],
'symbols_to_index' => $config['symbols_to_index'],
'enable_nested_fields' => $config['enable_nested_fields'] ?? false,
'embed' => $config['embed'] ?? null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ahmed-bhs what is this embed attribute ? I don't see it in Typesense doc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @npotier ,

You're absolutely right! The embed attribute only exists at the field level in Typesense, not at the collection level.

However in your PR #121 , you added the $embed parameter to CollectionClient::create() and passed $definition['embed'] ?? null. Since this is always null (embed only exists in fields), what was the intended use case?

- Remove embed from collection config (only exists at field level)
- Update CollectionClient and CollectionManager accordingly
- Improve test coverage for embed field configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants