Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ func TestNearTextWithDistance(t *testing.T) {
t.Logf("%s", jsonResponse)

points := response.Data["Aggregate"].(map[string]interface{})["JeopardyQuestion"].([]interface{})[0].(map[string]interface{})["points"].(map[string]interface{})
assert.NotNil(t, points["sum"])
assert.Greater(t, points["sum"].(float64), float64(0))
}

Expand Down
30 changes: 29 additions & 1 deletion _includes/code/howto/go/docs/mainpkg/search-generative_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,34 @@ import (
"github.com/weaviate/weaviate-go-client/v4/weaviate/graphql"
)

func TestDynamicRag(t *testing.T) {
// START DynamicRag
//const reviews = client.collections.use("WineReviewNV")

client := setupClient()
ctx := context.Background()
generatePrompt := "Translate this into German: {review_body}"
gs := graphql.NewGenerativeSearch().SingleResult(generatePrompt).GroupedResult("Summarize these reviews")

response, err := client.GraphQL().Get().
WithClassName("WineReviewNV").
WithGenerativeSearch(gs).
WithNearText((&graphql.NearTextArgumentBuilder{}).
WithConcepts([]string{"a sweet German white wine"}).WithTargetVectors("title_country")).
WithLimit(2).
Do(ctx)
require.NoError(t, err)
require.NotNil(t, response)
// END DynamicRag

// Test results
_, ok := response.Data["Get"].(map[string]interface{})["WineReviewNV"]
assert.True(t, ok)
//assert "title" in response.objects[0].properties.keys()
// End test

}

// =====================================
// ===== SINGLE GENERATIVE EXAMPLE =====
// =====================================
Expand Down Expand Up @@ -192,4 +220,4 @@ func TestGroupedGenerativeProperties(t *testing.T) {
assert.True(t, strings.Contains(generate["groupedResult"].(string), "Australia"))
}
}
}
}