Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(persistence): span query DSL with SQL #2911

Merged
merged 13 commits into from
Apr 19, 2024
Merged
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
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;
};
Loading
Loading