Elliot Wright
08/30/2024, 2:07 PMJason Bosco
08/30/2024, 5:01 PMJason Bosco
08/30/2024, 5:02 PMJason Bosco
08/30/2024, 5:02 PMJason Bosco
08/30/2024, 5:03 PMJason Bosco
08/30/2024, 5:03 PMJason Bosco
08/30/2024, 5:04 PMElliot Wright
09/10/2024, 9:02 AMElliot Wright
09/10/2024, 9:03 AM### Create conversation model
POST <http://localhost:8108/conversations/models>
Content-Type: application/json
X-TYPESENSE-API-KEY: xyz
{
"id": "conv-model-1",
"model_name": "cloudflare/@cf/meta/llama-2-7b-chat-fp16",
"history_collection": "conversation_store",
"api_key": "<snip>",
"account_id": "<snip>",
"system_prompt": "You are an assistant for question-answering. You can only make conversations based on the provided context. If a response cannot be formed strictly using the provided context, politely say you do not have knowledge about that topic.",
"max_bytes": 16384
}
Elliot Wright
09/10/2024, 9:04 AM$ typesense-server --help
Typesense 27.0
Invalid configuration: Data directory is not specified.
Command line usage: ./typesense-server --data-dir=string --api-key=string [options] ...
Elliot Wright
09/10/2024, 9:04 AMElliot Wright
09/10/2024, 9:04 AM### Create the deals collection in local Typesense
POST <http://localhost:8108/collections>
Content-Type: application/json
X-TYPESENSE-API-KEY: xyz
{
"name": "deals",
"fields": [
{"name": "brandId", "type": "int64"},
{"name": "advertiserName", "type": "string"},
{"name": "brandLogoUrl", "type": "string" },
{"name": "searchDestinationId", "type": "int64" },
{"name": "searchDestinationName", "type": "string" },
{"name": "ttiCode", "type": "int64" },
{"name": "hotelName", "type": "string" },
{"name": "departureAirportIata", "type": "string" },
{"name": "departureAirportName", "type": "string" },
{"name": "searchIatas", "type": "string[]" },
{"name": "departureDate", "type": "string" },
{"name": "duration", "type": "int64" },
{"name": "boardBasisCode", "type": "string" },
{"name": "boardBasisName", "type": "string" },
{"name": "pricePence", "type": "int64" },
{"name": "totalPricePence", "type": "int64" },
{"name": "usps", "type": "string[]" },
{"name": "adults", "type": "int64" },
{"name": "children", "type": "int64" },
{"name": "infants", "type": "int64" },
{"name": "childAges", "type": "int64[]" },
{"name": "deepLink", "type": "string" },
{"name": "deepLinkUrl", "type": "string" },
{"name": "offerScore", "type": "int64" },
{
"name": "embedding",
"type": "float[]",
"embed": {
"from": [
"advertiserName",
"searchDestinationName",
"hotelName",
"departureAirportName",
"departureDate",
"boardBasisName",
"usps"
],
"model_config": {
"model_name": "ts/all-MiniLM-L12-v2"
}
}
}
]
}
Elliot Wright
09/10/2024, 9:06 AM### Converse...
POST <http://localhost:8108/multi_search?q=where+could+I+go+on+holiday+for+less+then+>£600?&conversation=true&
conversation_model_id=conv-model-1
Content-Type: application/json
X-TYPESENSE-API-KEY: xyz
{
"searches": [
{
"collection": "deals",
"query_by": "embedding",
"exclude_fields": "embedding"
}
]
}
Elliot Wright
09/10/2024, 9:06 AM{
"conversation": {
"answer": "",
"conversation_history": [
{
"user": "where could I go on holiday for less then £600?"
},
{
"assistant": ""
}
],
"conversation_id": "c972456d-e581-442c-9ef6-48bb905368d1",
"query": "where could I go on holiday for less then £600?"
},
"results": [
{
"facet_counts": [],
"found": 10,
"hits": [
{
Elliot Wright
09/10/2024, 9:07 AMElliot Wright
09/10/2024, 9:24 AMElliot Wright
09/10/2024, 10:03 AM