Skip to content

Commit

Permalink
Merge pull request #61 from cofacts/ai-phase0
Browse files Browse the repository at this point in the history
feat(airesponses): add ai response index
  • Loading branch information
MrOrz authored Apr 1, 2023
2 parents 905e0df + 05bc80e commit 0b9112f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
40 changes: 40 additions & 0 deletions schema/airesponses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
export const VERSION = '1.0.0';

// A response from AI. Can be AI reply, OCR, speech to text, etc.
//
export default {
properties: {
// the document ID for this response
docId: { type: 'keyword' },

// type of this AI response.
type: { type: 'keyword' },

// The user that requests an AI response
//
userId: { type: 'keyword' },
appId: { type: 'keyword' },

// LOADING | SUCCESS | ERROR
status: { type: 'keyword' },

// AI response text
text: { type: 'text', analyzer: 'cjk_url_email' },

// The request to AI endpoint. Just for record, not indexed.
request: { type: 'keyword', index: false, doc_values: false },

// Token stats from AI endpoint response.
usage: {
type: 'object',
properties: {
promptTokens: { type: 'long' },
completionTokens: { type: 'long' },
totalTokens: { type: 'long' },
},
},

createdAt: { type: 'date' },
updatedAt: { type: 'date' },
},
};
2 changes: 2 additions & 0 deletions schema/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { default as replies } from './replies';
import { default as replyrequests } from './replyrequests';
import { default as urls } from './urls';
import { default as users } from './users';
import { default as airesponses } from './airesponses';

export {
analytics,
Expand All @@ -18,4 +19,5 @@ export {
replyrequests,
urls,
users,
airesponses,
};

0 comments on commit 0b9112f

Please sign in to comment.