Repository: meilisearch/meilisearch-go

Issue:
[v1.15] Experimental feature chat completions
**Description**

Meilisearch v1.15.1 adds new experimental conversational features and enables LLM-driven chat features.

https://www.meilisearch.com/docs/reference/api/experimental_features

**Basic example**

```bash
curl \
  -X PATCH 'http://localhost:7700/experimental-features/' \
  -H 'Authorization: Bearer <master-key>' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "chatCompletions": true
  }'
```

**References**

- https://www.meilisearch.com/docs/guides/ai/getting_started_with_chat
- https://www.meilisearch.com/docs/reference/api/chats
- https://www.meilisearch.com/docs/learn/ai_powered_search/conversational_search_with_chat


Discussion:

Solution patch:
diff --git a/features.go b/features.go
index f76b087..0738ed9 100644
--- a/features.go
+++ b/features.go
@@ -44,6 +44,11 @@ func (ef *ExperimentalFeatures) SetCompositeEmbedders(enable bool) *Experimental
 	return ef
 }
 
+func (ef *ExperimentalFeatures) SetChatCompletions(enable bool) *ExperimentalFeatures {
+	ef.ChatCompletions = &enable
+	return ef
+}
+
 func (ef *ExperimentalFeatures) Get() (*ExperimentalFeaturesResult, error) {
 	return ef.GetWithContext(context.Background())
 }
@@ -79,6 +84,7 @@ func (ef *ExperimentalFeatures) UpdateWithContext(ctx context.Context) (*Experim
 		ContainsFilter:          ef.ContainsFilter,
 		Network:                 ef.Network,
 		CompositeEmbedders:      ef.CompositeEmbedders,
+		ChatCompletions:         ef.ChatCompletions,
 	}
 	resp := new(ExperimentalFeaturesResult)
 	req := &internalRequest{
diff --git a/types.go b/types.go
index 55b5a1b..b1547c8 100644
--- a/types.go
+++ b/types.go
@@ -536,6 +536,7 @@ type ExperimentalFeaturesBase struct {
 	ContainsFilter          *bool `json:"containsFilter,omitempty"`
 	Network                 *bool `json:"network,omitempty"`
 	CompositeEmbedders      *bool `json:"compositeEmbedders,omitempty"`
+	ChatCompletions         *bool `json:"chatCompletions,omitempty"`
 }
 
 type ExperimentalFeaturesResult struct {
@@ -545,6 +546,7 @@ type ExperimentalFeaturesResult struct {
 	ContainsFilter          bool `json:"containsFilter"`
 	Network                 bool `json:"network"`
 	CompositeEmbedders      bool `json:"compositeEmbedders"`
+	ChatCompletions         bool `json:"chatCompletions"`
 }
 
 type SwapIndexesParams struct {



Test patch:
diff --git a/integration/features_test.go b/integration/features_test.go
index fc5632a..8106896 100644
--- a/integration/features_test.go
+++ b/integration/features_test.go
@@ -67,6 +67,7 @@ func TestUpdate_ExperimentalFeatures(t *testing.T) {
 			ef.SetContainsFilter(true)
 			ef.SetNetwork(true)
 			ef.SetCompositeEmbedders(true)
+			ef.SetChatCompletions(true)
 			gotResp, err := ef.Update()
 			require.NoError(t, err)
 
@@ -76,6 +77,7 @@ func TestUpdate_ExperimentalFeatures(t *testing.T) {
 			require.Equal(t, true, gotResp.ContainsFilter, "ExperimentalFeatures.Update() should return containsFilter as true")
 			require.Equal(t, true, gotResp.Network, "ExperimentalFeatures.Update() should return network as true")
 			require.Equal(t, true, gotResp.CompositeEmbedders, "ExperimentalFeatures.Update() should return composite embedders as true")
+			require.Equal(t, true, gotResp.ChatCompletions, "ExperimentalFeatures.Update() should return chat completions as true")
 		})
 	}
 }