mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
feat: embedding router
This commit is contained in:
+269
-43
@@ -50,6 +50,52 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/embeddings": {
|
||||
"post": {
|
||||
"description": "Create text or multimodal embeddings",
|
||||
"tags": [
|
||||
"embeddings"
|
||||
],
|
||||
"summary": "Create embeddings",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Embeddings request",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlers.EmbeddingsRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlers.EmbeddingsResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"501": {
|
||||
"description": "Not Implemented",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlers.EmbeddingsResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/fs/apply_patch": {
|
||||
"post": {
|
||||
"description": "Apply a unified diff patch to a file under the user data mount",
|
||||
@@ -353,6 +399,46 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/memory/embed": {
|
||||
"post": {
|
||||
"description": "Embed text or multimodal input and upsert into memory store",
|
||||
"tags": [
|
||||
"memory"
|
||||
],
|
||||
"summary": "Embed and upsert memory",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Embed upsert request",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/memory.EmbedUpsertRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/memory.EmbedUpsertResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/memory/memories": {
|
||||
"get": {
|
||||
"description": "List memories for a user via memory",
|
||||
@@ -1033,6 +1119,83 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"handlers.EmbeddingsInput": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"image_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"text": {
|
||||
"type": "string"
|
||||
},
|
||||
"video_url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handlers.EmbeddingsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
},
|
||||
"input": {
|
||||
"$ref": "#/definitions/handlers.EmbeddingsInput"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handlers.EmbeddingsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
},
|
||||
"embedding": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"usage": {
|
||||
"$ref": "#/definitions/handlers.EmbeddingsUsage"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handlers.EmbeddingsUsage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"image_tokens": {
|
||||
"type": "integer"
|
||||
},
|
||||
"input_tokens": {
|
||||
"type": "integer"
|
||||
},
|
||||
"video_tokens": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handlers.ErrorResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1205,6 +1368,74 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"memory.EmbedInput": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"image_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"text": {
|
||||
"type": "string"
|
||||
},
|
||||
"video_url": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"memory.EmbedUpsertRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"agent_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"filters": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"input": {
|
||||
"$ref": "#/definitions/memory.EmbedInput"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"type": "string"
|
||||
},
|
||||
"run_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"source": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"user_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"memory.EmbedUpsertResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
},
|
||||
"item": {
|
||||
"$ref": "#/definitions/memory.MemoryItem"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"memory.MemoryItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1271,6 +1502,12 @@
|
||||
"run_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"sources": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"user_id": {
|
||||
"type": "string"
|
||||
}
|
||||
@@ -1305,18 +1542,15 @@
|
||||
"models.AddRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"api_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"base_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"client_type": {
|
||||
"$ref": "#/definitions/models.ClientType"
|
||||
},
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
},
|
||||
"is_multimodal": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"llm_provider_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"model_id": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -1324,7 +1558,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/models.ModelType"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1339,19 +1573,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ClientType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"openai",
|
||||
"anthropic",
|
||||
"google"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"ClientTypeOpenAI",
|
||||
"ClientTypeAnthropic",
|
||||
"ClientTypeGoogle"
|
||||
]
|
||||
},
|
||||
"models.CountResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1363,18 +1584,15 @@
|
||||
"models.GetResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"api_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"base_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"client_type": {
|
||||
"$ref": "#/definitions/models.ClientType"
|
||||
},
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
},
|
||||
"is_multimodal": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"llm_provider_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"model_id": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -1382,25 +1600,33 @@
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/models.ModelType"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ModelType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"chat",
|
||||
"embedding"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"ModelTypeChat",
|
||||
"ModelTypeEmbedding"
|
||||
]
|
||||
},
|
||||
"models.UpdateRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"api_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"base_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"client_type": {
|
||||
"$ref": "#/definitions/models.ClientType"
|
||||
},
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
},
|
||||
"is_multimodal": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"llm_provider_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"model_id": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -1408,7 +1634,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/models.ModelType"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user