- Temporary checkin to branch for the rest of the introduction of experts

This commit is contained in:
Josako
2024-11-03 16:18:14 +01:00
parent 88f4db1178
commit 503ea7965d
9 changed files with 70 additions and 7 deletions

View File

@@ -4,8 +4,6 @@ eveai_beat/
eveai_chat/ eveai_chat/
eveai_chat_workers/ eveai_chat_workers/
eveai_entitlements/ eveai_entitlements/
eveai_workers/
instance/ instance/
integrations/
nginx/ nginx/
scripts/ scripts/

View File

@@ -25,6 +25,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security ### Security
- In case of vulnerabilities. - In case of vulnerabilities.
## [1.0.14-alfa]
### Added
- New release script added to tag images with release number
- Allow the addition of multiple types of Catalogs
- Generic functionality to enable dynamic fields
- Addition of Retrievers to allow for smart collection of information in Catalogs
- Add dynamic fields to Catalog / Retriever / DocumentVersion
### Changed
- Processing parameters defined at Catalog level iso Tenant level
- Reroute 'blank' paths to 'admin'
### Deprecated
- For soon-to-be removed features.
### Removed
- For now removed features.
### Fixed
- Set default language when registering Documents or URLs.
### Security
- In case of vulnerabilities.
## [1.0.13-alfa] ## [1.0.13-alfa]
### Added ### Added

View File

@@ -53,6 +53,7 @@ class Retriever(db.Model):
user_metadata = db.Column(JSONB, nullable=True) user_metadata = db.Column(JSONB, nullable=True)
system_metadata = db.Column(JSONB, nullable=True) system_metadata = db.Column(JSONB, nullable=True)
configuration = db.Column(JSONB, nullable=True) configuration = db.Column(JSONB, nullable=True)
arguments = db.Column(JSONB, nullable=True)
# Versioning Information # Versioning Information
created_at = db.Column(db.DateTime, nullable=False, server_default=db.func.now()) created_at = db.Column(db.DateTime, nullable=False, server_default=db.func.now())

View File

@@ -1,6 +1,8 @@
from sqlalchemy.dialects.postgresql import JSONB
from ..extensions import db from ..extensions import db
from .user import User, Tenant from .user import User, Tenant
from .document import Embedding from .document import Embedding, Retriever
class ChatSession(db.Model): class ChatSession(db.Model):
@@ -44,3 +46,16 @@ class Interaction(db.Model):
class InteractionEmbedding(db.Model): class InteractionEmbedding(db.Model):
interaction_id = db.Column(db.Integer, db.ForeignKey(Interaction.id, ondelete='CASCADE'), primary_key=True) interaction_id = db.Column(db.Integer, db.ForeignKey(Interaction.id, ondelete='CASCADE'), primary_key=True)
embedding_id = db.Column(db.Integer, db.ForeignKey(Embedding.id, ondelete='CASCADE'), primary_key=True) embedding_id = db.Column(db.Integer, db.ForeignKey(Embedding.id, ondelete='CASCADE'), primary_key=True)
class Specialist(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(20), nullable=False)
tuning = db.Column(db.Boolean, nullable=True, default=False)
configuration = db.Column(JSONB, nullable=True)
arguments = db.Column(JSONB, nullable=True)
class SpecialistRetriever(db.Model):
specialist_id = db.Column(db.Integer, db.ForeignKey(Specialist.id, ondelete='CASCADE'), primary_key=True)
retriever_id = db.Column(db.Integer, db.ForeignKey(Retriever.id, ondelete='CASCADE'), primary_key=True)

View File

@@ -1,6 +1,6 @@
# Catalog Types # Catalog Types
CATALOG_TYPES = { CATALOG_TYPES = {
"DEFAULT": { "STANDARD": {
"name": "Default Catalog", "name": "Default Catalog",
"Description": "A Catalog with information in Evie's Library, to be considered as a whole", "Description": "A Catalog with information in Evie's Library, to be considered as a whole",
"configuration": {} "configuration": {}

View File

@@ -1,6 +1,6 @@
# Retriever Types # Retriever Types
RETRIEVER_TYPES = { RETRIEVER_TYPES = {
"DEFAULT_RAG": { "STANDARD_RAG": {
"name": "Default RAG", "name": "Default RAG",
"description": "Retrieving all embeddings conform the query", "description": "Retrieving all embeddings conform the query",
"configuration": { "configuration": {

View File

@@ -0,0 +1,23 @@
# Specialist Types
SPECIALIST_TYPES = {
"STANDARD_RAG": {
"name": "Q&A RAG Specialist",
"description": "Standard Q&A through RAG Specialist",
"configuration": {
"specialist_context": {
"name": "Specialist Context",
"type": "text",
"description": "The context to be used by the specialist.",
"required": False,
},
},
"arguments": {
"language": {
"name": "Language",
"type": "str",
"description": "Language code to be used for receiving questions and giving answers",
"required": True,
},
}
}
}

View File

@@ -75,6 +75,7 @@ class DynamicFormBase(FlaskForm):
'float': FloatField, 'float': FloatField,
'boolean': BooleanField, 'boolean': BooleanField,
'string': StringField, 'string': StringField,
'text': TextAreaField,
'date': DateField, 'date': DateField,
}.get(field_type, StringField) }.get(field_type, StringField)
field_kwargs = {} field_kwargs = {}

View File

@@ -132,7 +132,7 @@ def answer_using_tenant_rag(question, language, tenant, chat_session):
new_interaction.detailed_question_at = dt.now(tz.utc) new_interaction.detailed_question_at = dt.now(tz.utc)
with current_event.create_span("Generate Answer using RAG"): with current_event.create_span("Generate Answer using RAG"):
retriever = EveAIDefaultRagRetriever(model_variables, tenant_info) retriever = EveAIDefaultRagRetriever(1, model_variables, tenant_info)
llm = model_variables['llm'] llm = model_variables['llm']
template = model_variables['rag_template'] template = model_variables['rag_template']
language_template = create_language_template(template, language) language_template = create_language_template(template, language)
@@ -236,7 +236,7 @@ def answer_using_llm(question, language, tenant, chat_session):
new_interaction.detailed_question_at = dt.now(tz.utc) new_interaction.detailed_question_at = dt.now(tz.utc)
with current_event.create_span("Detail Answer using LLM"): with current_event.create_span("Detail Answer using LLM"):
retriever = EveAIDefaultRagRetriever(model_variables, tenant_info) retriever = EveAIDefaultRagRetriever(1, model_variables, tenant_info)
llm = model_variables['llm_no_rag'] llm = model_variables['llm_no_rag']
template = model_variables['encyclopedia_template'] template = model_variables['encyclopedia_template']
language_template = create_language_template(template, language) language_template = create_language_template(template, language)