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
@npotier npotier changed the base branch from master to feature/custom-embedding-services January 16, 2026 13:57
@npotier npotier merged commit 9d4357d into acseo:feature/custom-embedding-services Jan 16, 2026
npotier added a commit that referenced this pull request Jan 16, 2026
…vices (#137) (#148)

* feat: Add api_key and url parameters for custom embedding services

Allows using OpenAI-compatible APIs (Ollama, custom models)
instead of only Typesense Cloud models for embeddings.

* test: Add test case for custom embedding service configuration

Validates that api_key and url parameters are properly accepted
in embed.model_config without throwing exceptions.

* fix: Remove invalid embed parameter at collection level

- Remove embed from collection config (only exists at field level)
- Update CollectionClient and CollectionManager accordingly
- Improve test coverage for embed field configuration

---------

Co-authored-by: Ahmed EBEN HASSINE 脳の流れ <ahmedbhs123@gmail.com>
Co-authored-by: Ahmed EBEN HASSINE <ahmed.eben-hassine@codein.fr>
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