Skip to content

Conversation

@jaeyson
Copy link
Owner

@jaeyson jaeyson commented Aug 11, 2025

Closes #34

Summary by Sourcery

Support Typesense API v29.0 by extending the spec and client with natural language search model management, search parameter enhancements (metadata, NL query, hybrid scoring, union searches), updating build and CI configurations, and upgrading version and Docker images.

New Features:

  • Add NL search models endpoints with full CRUD operations and corresponding Elixir schemas and tests

Enhancements:

  • Update OpenAPI spec to v29.0 with license and server configuration, add metadata to collection schemas, and introduce SearchRequestParams and hybrid search fields
  • Refine MultiSearch and SearchResult structs to include union_request_params and explicit request_params types

Build:

  • Add new CI GitHub Actions workflow for Typesense v29.0, update existing CI config and README badges, and bump mix project version to 1.1.0

Deployment:

  • Update docker-compose to use Typesense 29.0 and dashboard 2.1.0

Tests:

  • Update existing tests to tag support for v29.0 and add coverage for NL search models

@jaeyson jaeyson self-assigned this Aug 11, 2025
@jaeyson jaeyson added the documentation Improvements or additions to documentation label Aug 11, 2025
@jaeyson jaeyson linked an issue Aug 11, 2025 that may be closed by this pull request
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 11, 2025

Reviewer's Guide

This PR upgrades the client and spec to Typesense v29.0, enriching the OpenAPI spec with license, server details, metadata, new NL search model endpoints and components, adjusting client modules and project configuration (version bumps, CI, Docker), extending existing schemas with metadata and search enhancements, and updating tests for v29.0 compatibility.

Class diagram for NLSearchModel schemas and operations

classDiagram
  class NLSearchModelBase {
    +model_name: string
    +api_key: string
    +api_url: string
    +max_bytes: integer
    +temperature: number
    +system_prompt: string
    +top_p: number
    +top_k: integer
    +stop_sequences: string[]
    +api_version: string
    +project_id: string
    +access_token: string
    +refresh_token: string
    +client_id: string
    +client_secret: string
    +region: string
    +max_output_tokens: integer
    +account_id: string
  }
  class NLSearchModelCreateSchema {
    +id: string
    <<extends NLSearchModelBase>>
  }
  class NLSearchModelSchema {
    +id: string
    <<extends NLSearchModelCreateSchema>>
  }
  class NLSearchModelUpdateSchema {
    <<extends NLSearchModelCreateSchema>>
  }
  class NLSearchModelDeleteSchema {
    +id: string
  }
  NLSearchModelCreateSchema <|-- NLSearchModelSchema
  NLSearchModelBase <|-- NLSearchModelCreateSchema
  NLSearchModelCreateSchema <|-- NLSearchModelUpdateSchema
Loading

Class diagram for extended Collection schemas with metadata

classDiagram
  class CollectionSchema {
    +fields: Field[]
    +metadata: map
    +name: string
    +default_sorting_field: string
    +enable_nested_fields: boolean
    +symbols_to_index: string[]
    +token_separators: string[]
  }
  class CollectionUpdateSchema {
    +fields: Field[]
    +metadata: map
  }
  class CollectionResponse {
    +fields: Field[]
    +metadata: map
    +name: string
    +num_documents: integer
    +default_sorting_field: string
    +enable_nested_fields: boolean
    +symbols_to_index: string[]
    +token_separators: string[]
  }
Loading

Class diagram for Search enhancements (SearchRequestParams, SearchResultHit, MultiSearch)

classDiagram
  class SearchRequestParams {
    +collection_name: string
    +q: string
    +per_page: integer
    +voice_query: SearchRequestParamsVoiceQuery
  }
  class SearchRequestParamsVoiceQuery {
    +transcribed_query: string
  }
  class SearchResultHit {
    +hybrid_search_info: SearchResultHitHybridSearchInfo
    +search_index: integer
    +geo_distance_meters: SearchResultHitGeoDistanceMeters
    +highlight: map
    +highlights: SearchHighlight[]
    +text_match: integer
    +text_match_info: SearchResultHitTextMatchInfo
    +vector_distance: number
  }
  class SearchResultHitHybridSearchInfo {
    +rank_fusion_score: number
  }
  class MultiSearchResultItem {
    +hits: SearchResultHit[]
    +out_of: integer
    +page: integer
    +request_params: SearchRequestParams
    +union_request_params: SearchRequestParams[]
    +search_cutoff: boolean
    +search_time_ms: integer
    +conversation: SearchResultConversation
  }
  class SearchResult {
    +hits: SearchResultHit[]
    +out_of: integer
    +page: integer
    +request_params: SearchRequestParams
    +union_request_params: SearchRequestParams[]
    +search_cutoff: boolean
    +search_time_ms: integer
    +conversation: SearchResultConversation
  }
  SearchRequestParams --> SearchRequestParamsVoiceQuery
  SearchResultHit --> SearchResultHitHybridSearchInfo
  MultiSearchResultItem --> SearchRequestParams
  MultiSearchResultItem --> SearchResultHit
  SearchResult --> SearchRequestParams
  SearchResult --> SearchResultHit
Loading

File-Level Changes

Change Details Files
Update OpenAPI specification for v29.0
  • Bump spec version from 28.0 to 29.0 and add license information
  • Add server variables block and correct existing typo
  • Introduce nl_search_models tag and its CRUD paths
  • Embed new metadata and hybrid search components in schema definitions
priv/open_api.yml
Introduce NL search model API
  • Add operations module for create/retrieve/list/update/delete NL search models
  • Define NLSearchModel schemas (base, create, update, delete, schema)
  • Implement SearchRequestParams and voice_query helper schemas
  • Introduce SearchResultHitHybridSearchInfo schema
  • Add comprehensive NLSearchModels tests
.github/workflows/ci_v29.0.yml
lib/open_api_typesense/operations/nl_search_models.ex
lib/open_api_typesense/schemas/nl_search_model_create_schema.ex
lib/open_api_typesense/schemas/nl_search_model_schema.ex
lib/open_api_typesense/schemas/nl_search_model_delete_schema.ex
lib/open_api_typesense/schemas/search_request_params.ex
lib/open_api_typesense/schemas/search_request_params_voice_query.ex
lib/open_api_typesense/schemas/search_result_hit_hybrid_search_info.ex
test/operations/nl_search_models_test.exs
Adjust client code and project configuration for v29.0
  • Update MultiSearchResultItem and SearchResult structs to include union_request_params and typed request_params
  • Set default union flag in multi-search parameter struct
  • Add 400 response in Curation operations and clean up Conversations docs
  • Revise Client.parse_body to handle generic bodies
  • Bump mix project version and dependency in README, add CI badge
  • Update Docker Compose images to Typesense 29.0 and dashboard 2.1.0
  • Disable lint in v28 CI and introduce new CI workflow for v29.0
mix.exs
README.md
docker-compose.yml
.github/workflows/ci_v28.0.yml
.github/workflows/ci_v29.0.yml
lib/open_api_typesense/client.ex
lib/open_api_typesense/schemas/multi_search_result_item.ex
lib/open_api_typesense/schemas/search_result.ex
lib/open_api_typesense/schemas/multi_search_searches_parameter.ex
lib/open_api_typesense/operations/conversations.ex
lib/open_api_typesense/operations/curation.ex
Enhance existing schema modules with metadata and search features
  • Add metadata field to CollectionSchema, CollectionUpdateSchema and CollectionResponse
  • Extend SearchParameters with nl_model_id and nl_query properties
  • Augment SearchResultHit with hybrid_search_info and search_index fields
lib/open_api_typesense/schemas/collection_schema.ex
lib/open_api_typesense/schemas/collection_update_schema.ex
lib/open_api_typesense/schemas/collection_response.ex
lib/open_api_typesense/schemas/search_parameters.ex
lib/open_api_typesense/schemas/search_result_hit.ex
Update Stemming tests for v29.0 compatibility
  • Extend version tags in StemmingTest to include v29.0
  • Adjust expected error message for non-existent dictionary
test/operations/stemming_test.exs

Assessment against linked issues

Issue Objective Addressed Explanation
#34 Update the codebase to support Typesense v29.0, including API changes, new endpoints, schemas, and features introduced in v29.0.
#34 Add documentation and CI configuration for v29.0 support.
#34 Add or update tests to verify functionality against Typesense v29.0.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@jaeyson jaeyson moved this to Todo in OpenAPI Typesense Aug 11, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jaeyson - I've reviewed your changes - here's some feedback:

  • There’s a typo in open_api.yml under externalDocs—“Typsesense” should be “Typesense.”
  • The new nl_search_models tests reference a Keys module without aliasing it—either alias the correct module or update the calls to use NlSearchModels.
  • NLSearchModelSchema only defines id, but the API’s list/retrieve endpoints likely return the full model configuration—please extend the schema to mirror all returned fields.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There’s a typo in open_api.yml under externalDocs—“Typsesense” should be “Typesense.”
- The new nl_search_models tests reference a `Keys` module without aliasing it—either alias the correct module or update the calls to use `NlSearchModels`.
- NLSearchModelSchema only defines `id`, but the API’s list/retrieve endpoints likely return the full model configuration—please extend the schema to mirror all returned fields.

## Individual Comments

### Comment 1
<location> `priv/open_api.yml:23` </location>
<code_context>
+        description: The port of your Typesense server
 externalDocs:
-  description: Find out more about Typesense
+  description: Find out more about Typsesense
   url: https://typesense.org
 security:
</code_context>

<issue_to_address>
Typo in 'Typsesense' should be 'Typesense'.

Please update the externalDocs description to use the correct spelling: 'Typesense'.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
externalDocs:
  description: Find out more about Typsesense
  url: https://typesense.org
=======
externalDocs:
  description: Find out more about Typesense
  url: https://typesense.org
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Absence of Expected Change Pattern

  • open_api_typesense/lib/open_api_typesense/operations/operations.ex is usually changed with: open_api_typesense/lib/open_api_typesense/operations/collections.ex, open_api_typesense/lib/open_api_typesense/operations/debug.ex, open_api_typesense/lib/open_api_typesense/operations/override.ex, open_api_typesense/lib/open_api_typesense/operations/presets.ex, open_api_typesense/lib/open_api_typesense/operations/stopwords.ex
  • open_api_typesense/lib/open_api_typesense/operations/curation.ex is usually changed with: open_api_typesense/lib/open_api_typesense/operations/debug.ex, open_api_typesense/lib/open_api_typesense/operations/stopwords.ex, open_api_typesense/lib/open_api_typesense/operations/documents.ex, open_api_typesense/lib/open_api_typesense/operations/presets.ex, open_api_typesense/lib/open_api_typesense/operations/synonyms.ex, open_api_typesense/lib/open_api_typesense/operations/override.ex
  • open_api_typesense/lib/open_api_typesense/operations/analytics.ex is usually changed with: open_api_typesense/lib/open_api_typesense/operations/debug.ex, open_api_typesense/lib/open_api_typesense/operations/override.ex, open_api_typesense/lib/open_api_typesense/operations/presets.ex
  • open_api_typesense/lib/open_api_typesense/operations/conversations.ex is usually changed with: open_api_typesense/lib/open_api_typesense/operations/documents.ex, open_api_typesense/lib/open_api_typesense/operations/override.ex, open_api_typesense/lib/open_api_typesense/operations/keys.ex, open_api_typesense/lib/open_api_typesense/operations/presets.ex, open_api_typesense/lib/open_api_typesense/operations/synonyms.ex

Quality Gate Profile: The Bare Minimum
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.

codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Absence of Expected Change Pattern

  • open_api_typesense/lib/open_api_typesense/operations/operations.ex is usually changed with: open_api_typesense/lib/open_api_typesense/operations/collections.ex, open_api_typesense/lib/open_api_typesense/operations/debug.ex, open_api_typesense/lib/open_api_typesense/operations/override.ex, open_api_typesense/lib/open_api_typesense/operations/presets.ex, open_api_typesense/lib/open_api_typesense/operations/stopwords.ex
  • open_api_typesense/lib/open_api_typesense/operations/curation.ex is usually changed with: open_api_typesense/lib/open_api_typesense/operations/debug.ex, open_api_typesense/lib/open_api_typesense/operations/stopwords.ex, open_api_typesense/lib/open_api_typesense/operations/documents.ex, open_api_typesense/lib/open_api_typesense/operations/presets.ex, open_api_typesense/lib/open_api_typesense/operations/synonyms.ex, open_api_typesense/lib/open_api_typesense/operations/override.ex
  • open_api_typesense/lib/open_api_typesense/operations/analytics.ex is usually changed with: open_api_typesense/lib/open_api_typesense/operations/debug.ex, open_api_typesense/lib/open_api_typesense/operations/override.ex, open_api_typesense/lib/open_api_typesense/operations/presets.ex
  • open_api_typesense/lib/open_api_typesense/operations/conversations.ex is usually changed with: open_api_typesense/lib/open_api_typesense/operations/documents.ex, open_api_typesense/lib/open_api_typesense/operations/override.ex, open_api_typesense/lib/open_api_typesense/operations/keys.ex, open_api_typesense/lib/open_api_typesense/operations/presets.ex, open_api_typesense/lib/open_api_typesense/operations/synonyms.ex

Quality Gate Profile: The Bare Minimum
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Add support for v29.0

2 participants