Skip to content

Commit

Permalink
feat(persistence): span query DSL with SQL (#2911)
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHYang committed Apr 19, 2024
1 parent 06eb320 commit 7c01420
Show file tree
Hide file tree
Showing 32 changed files with 5,674 additions and 1,677 deletions.
92 changes: 66 additions & 26 deletions app/src/openInference/tracing/types.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,86 @@
import {
DOCUMENT_CONTENT,
DOCUMENT_ID,
DOCUMENT_METADATA,
DOCUMENT_SCORE,
EMBEDDING_TEXT,
EmbeddingAttributePostfixes,
LLMAttributePostfixes,
LLMPromptTemplateAttributePostfixes,
MESSAGE_CONTENT,
MESSAGE_NAME,
MESSAGE_ROLE,
MESSAGE_TOOL_CALLS,
TOOL_CALL_FUNCTION_ARGUMENTS_JSON,
TOOL_CALL_FUNCTION_NAME,
MessageAttributePostfixes,
RerankerAttributePostfixes,
RetrievalAttributePostfixes,
ToolAttributePostfixes,
} from "@arizeai/openinference-semantic-conventions";
import {
DocumentAttributePostfixes,
SemanticAttributePrefixes,
} from "@arizeai/openinference-semantic-conventions/src/trace/SemanticConventions";

export type AttributeTool = {
[ToolAttributePostfixes.name]?: string;
[ToolAttributePostfixes.description]?: string;
[ToolAttributePostfixes.parameters]?: string;
};
export type AttributeToolCall = {
[TOOL_CALL_FUNCTION_NAME]: string;
[TOOL_CALL_FUNCTION_ARGUMENTS_JSON]: string;
function?: {
name?: string;
arguments?: string;
};
};

export type AttributeMessages = {
[SemanticAttributePrefixes.message]?: AttributeMessage;
}[];
export type AttributeMessage = {
[MESSAGE_ROLE]: string;
[MESSAGE_CONTENT]: string;
[MESSAGE_NAME]?: string;
[MESSAGE_TOOL_CALLS]?: AttributeToolCall[];
[key: string]: unknown;
[MessageAttributePostfixes.role]?: string;
[MessageAttributePostfixes.content]?: string;
[MessageAttributePostfixes.name]?: string;
[MessageAttributePostfixes.function_call_name]?: string;
[MessageAttributePostfixes.function_call_arguments_json]?: string;
[MessageAttributePostfixes.tool_calls]?: {
[SemanticAttributePrefixes.tool_call]?: AttributeToolCall;
}[];
};

export type AttributeRetrieval = {
[RetrievalAttributePostfixes.documents]?: {
[SemanticAttributePrefixes.document]?: AttributeDocument;
}[];
};
export type AttributeDocument = {
[DOCUMENT_ID]?: string;
[DOCUMENT_CONTENT]: string;
[DOCUMENT_SCORE]?: number;
[DOCUMENT_METADATA]?: string;
[key: string]: unknown;
[DocumentAttributePostfixes.id]?: string;
[DocumentAttributePostfixes.content]?: string;
[DocumentAttributePostfixes.score]?: number;
[DocumentAttributePostfixes.metadata]?: string;
};

export type AttributeEmbedding = {
[EMBEDDING_TEXT]?: string;
[key: string]: unknown;
[EmbeddingAttributePostfixes.model_name]?: string;
[EmbeddingAttributePostfixes.embeddings]?: {
[SemanticAttributePrefixes.embedding]?: AttributeEmbeddingEmbedding;
}[];
};
export type AttributeEmbeddingEmbedding = {
[EmbeddingAttributePostfixes.text]?: string;
};

export type AttributeReranker = {
[RerankerAttributePostfixes.query]?: string;
[RerankerAttributePostfixes.input_documents]?: {
[SemanticAttributePrefixes.document]?: AttributeDocument;
}[];
[RerankerAttributePostfixes.output_documents]?: {
[SemanticAttributePrefixes.document]?: AttributeDocument;
}[];
};

export type AttributeLlm = {
[LLMAttributePostfixes.model_name]?: string;
[LLMAttributePostfixes.token_count]?: number;
[LLMAttributePostfixes.input_messages]?: AttributeMessages;
[LLMAttributePostfixes.output_messages]?: AttributeMessages;
[LLMAttributePostfixes.invocation_parameters]?: string;
[LLMAttributePostfixes.prompts]?: string[];
[LLMAttributePostfixes.prompt_template]?: AttributePromptTemplate;
};

export type AttributePromptTemplate = {
[LLMPromptTemplateAttributePostfixes.template]: string;
[LLMPromptTemplateAttributePostfixes.variables]: Record<string, string>;
[key: string]: unknown;
};

0 comments on commit 7c01420

Please sign in to comment.