- Add configuration of agents, tasks, tools, specialist in context of SPIN specialist

- correct startup of applications using gevent
- introduce startup scripts (eveai_app)
- caching manager for all configurations
This commit is contained in:
Josako
2025-01-16 20:27:00 +01:00
parent f7cd58ed2a
commit 7bddeb0ebd
69 changed files with 1991 additions and 345 deletions

View File

@@ -0,0 +1,17 @@
version: "1.0.0"
name: "Email Content Agent"
role: >
Email Content Writer
goal: >
Craft a highly personalized email that resonates with the {end_user_role}'s context and identification (personal and
company if available).
{custom_goal}
backstory: >
You are an expert in writing compelling, personalized emails that capture the {end_user_role}'s attention and drive
engagement. You are perfectly multilingual, and can write the mail in the native language of the {end_user_role}.
{custom_backstory}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "An Agent that writes engaging emails."
changes: "Initial version"

View File

@@ -0,0 +1,16 @@
version: "1.0.0"
name: "Email Engagement Agent"
role: >
Engagement Optimization Specialist {custom_role}
goal: >
You ensure that the email includes strong CTAs and strategically placed engagement hooks that encourage the
{end_user_role} to take immediate action. {custom_goal}
backstory: >
You specialize in optimizing content to ensure that it not only resonates with the recipient but also encourages them
to take the desired action.
{custom_backstory}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "An Agent that ensures the email is engaging and lead to maximal desired action"
changes: "Initial version"

View File

@@ -0,0 +1,15 @@
version: "1.0.0"
name: "Identification Agent"
role: >
Identification Administrative force. {custom_role}
goal: >
You are an administrative force that tries to gather identification information of an end-user through conversation.
{custom_goal}
backstory: >
You are and administrative force for {company}. Your task is to identify the person in a conversation, so he or she
can easily be contacted later on. {custom_backstory}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "An Agent that gathers identification information"
changes: "Initial version"

View File

@@ -0,0 +1,19 @@
version: "1.0.0"
name: "Rag Agent"
role: >
{company} Spokesperson. {custom_role}
goal: >
You get questions by a human correspondent, and give answers based on a given context, taking into account the history
of the current conversation. {custom_goal}
backstory: >
You are the primary contact for {company}. You are known by {name}, and can be addressed by this name, or you. You are
a very good communicator, and adapt to the style used by the human asking for information (e.g. formal or informal).
You always stay correct and polite, whatever happens. And you ensure no discriminating language is used.
You are perfectly multilingual in all known languages, and do your best to answer questions in {language}, whatever
language the context provided to you is in.
{custom_backstory}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "An Agent that does RAG based on a user's question, RAG content & history"
changes: "Initial version"

View File

@@ -0,0 +1,22 @@
version: "1.0.0"
name: "SPIN Sales Assistant"
role: >
Sales Assistant for {company} on {products}. {custom_role}
goal: >
Your main job is to help your sales specialist to analyze an ongoing conversation with a customer, and detect
SPIN-related information. {custom_goal}
backstory: >
You are a sales assistant for {company} on {products}. You are known by {name}, and can be addressed by this name, or you. You are
trained to understand an analyse ongoing conversations. Your are proficient in detecting SPIN-related information in a
conversation.
SPIN stands for:
- Situation questions & information - Understanding the customer's current context
- Problem questions & information - Uncovering challenges and pain points
- Implication questions & information - Exploring consequences of those problems
- Need-payoff questions & information - Helping customers realize value of solutions
{custom_backstory}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "An Agent that detects SPIN information in an ongoing conversation"
changes: "Initial version"

View File

@@ -0,0 +1,25 @@
version: "1.0.0"
name: "SPIN Sales Specialist"
role: >
Sales Specialist for {company} on {products}. {custom_role}
goal: >
Your main job is to do sales using the SPIN selling methodology in a first conversation with a potential customer.
{custom_goal}
backstory: >
You are a sales specialist for {company} on {products}. You are known by {name}, and can be addressed by this name,
or you. You have an assistant that provides you with already detected SPIN-information in an ongoing conversation. You
decide on follow-up questions for more in-depth information to ensure we get the required information that may lead to
selling {products}.
SPIN stands for:
- Situation questions & information - Understanding the customer's current context
- Problem questions & information - Uncovering challenges and pain points
- Implication questions & information - Exploring consequences of those problems
- Need-payoff questions & information - Helping customers realize value of solutions
{custom_backstory}
You are acquainted with the following product information:
{product_information}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "An Agent that asks for Follow-up questions for SPIN-process"
changes: "Initial version"

View File

@@ -105,6 +105,7 @@ class Config(object):
# JWT settings
JWT_SECRET_KEY = environ.get('JWT_SECRET_KEY')
JWT_ACCESS_TOKEN_EXPIRES = timedelta(hours=1) # Set token expiry to 1 hour
JWT_ACCESS_TOKEN_EXPIRES_DEPLOY = timedelta(hours=24) # Set long-lived token for deployment
# API Encryption
API_ENCRYPTION_KEY = environ.get('API_ENCRYPTION_KEY')
@@ -165,7 +166,7 @@ class DevConfig(Config):
DEVELOPMENT = True
DEBUG = True
FLASK_DEBUG = True
EXPLAIN_TEMPLATE_LOADING = False
EXPLAIN_TEMPLATE_LOADING = True
# Database Settings
DB_HOST = environ.get('DB_HOST', 'localhost')

View File

@@ -0,0 +1,125 @@
version: 1.0.0
name: "Spin Sales Specialist"
framework: "crewai"
configuration:
name:
name: "name"
type: "str"
description: "The name the specialist is called upon."
required: true
company:
name: "company"
type: "str"
description: "The name of your company. If not provided, your tenant's name will be used."
required: false
products:
name: "products"
type: "List[str]"
description: "The products or services you're providing"
required: false
product_information:
name: "product_information"
type: "text"
description: "Information on the products you are selling, such as ICP (Ideal Customer Profile), Pitch, ..."
required: false
engagement_options:
name: "engagement_options"
type: "text"
description: "Engagement options such as email, phone number, booking link, ..."
tenant_language:
name: "tenant_language"
type: "str"
description: "The language code used for internal information. If not provided, the tenant's default language will be used"
required: false
arguments:
language:
name: "Language"
type: "str"
description: "Language code to be used for receiving questions and giving answers"
required: true
query:
name: "query"
type: "str"
description: "Query or response to process"
required: true
identification:
name: "identification"
type: "text"
description: "Initial identification information when available"
required: false
results:
detailed_query:
name: "detailed_query"
type: "str"
description: "The query detailed with the Chat Session History."
required: true
answer:
name: "answer"
type: "str"
description: "Answer to the query"
required: true
citations:
name: "citations"
type: "List[str]"
description: "List of citations"
required: false
insufficient_info:
name: "insufficient_info"
type: "bool"
description: "Whether or not the query is insufficient info"
required: true
spin:
situation_information:
name: "situation_information"
type: "List[str]"
description: "A list of situation descriptions"
required: false
problem_information:
name: "problem_information"
type: "List[str]"
description: "A list of problems"
required: false
implication_information:
name: "implication_information"
type: "List[str]"
description: "A list of implications"
required: false
needs_information:
name: "needs_information"
type: "List[str]"
description: "A list of needs"
required: false
agents:
- type: "RAG_AGENT"
version: 1.0
name: "Default RAG Agent" # Just added as an example. Overwrites the default agent name.
description: "An Agent that does RAG based on a user's question, RAG content & history" # Just added as an example. Overwrites the default agent description.
- type: "SPIN_DETECTION_AGENT"
version: 1.0
- type: "SPIN_SALES_SPECIALIST_AGENT"
version: 1.0
- type: "IDENTIFICATION_AGENT"
version: 1.0
- type: "EMAIL_CONTENT_AGENT"
version: 1.0
- type: "EMAIL_LEAD_ENGAGEMENT"
version: 1.0
tasks:
- type: "RAG_TASK"
version: 1.0
- type: "SPIN_DETECT_TASK"
version: 1.0
- type: "SPIN_QUESTIONS_TASK"
version: 1.0
- type: "IDENTIFICATION_DETECTION_TASK"
version: 1.0
- type: "IDENTIFICATION_QUESTIONS_TASK"
version: 1.0
- type: "EMAIL_LEAD_DRAFTING"
version: 1.0
- type: "EMAIL_LEAD_ENGAGEMENT"
version: 1.0
metadata:
author: "Josako"
date_added: "2025-01-08"
changes: "Initial version"

View File

@@ -0,0 +1,51 @@
version: 1.0.0
name: "Standard RAG Specialist"
framework: "langchain"
configuration:
specialist_context:
name: "Specialist Context"
type: "text"
description: "The context to be used by the specialist."
required: false
temperature:
name: "Temperature"
type: "number"
description: "The inference temperature to be used by the specialist."
required: false
default: 0.3
arguments:
language:
name: "Language"
type: "str"
description: "Language code to be used for receiving questions and giving answers"
required: true
query:
name: "query"
type: "str"
description: "Query to answer"
required: true
results:
detailed_query:
name: "detailed_query"
type: "str"
description: "The query detailed with the Chat Session History."
required: true
answer:
name: "answer"
type: "str"
description: "Answer to the query"
required: true
citations:
name: "citations"
type: "List[str]"
description: "List of citations"
required: false
insufficient_info:
name: "insufficient_info"
type: "bool"
description: "Whether or not the query is insufficient info"
required: true
metadata:
author: "Josako"
date_added: "2025-01-08"
changes: "Initial version"

View File

@@ -0,0 +1,34 @@
version: "1.0.0"
name: "Email Lead Draft Creation"
description: >
Craft a highly personalized email using the lead's name, job title, company information, and any relevant personal or
company achievements when available. The email should speak directly to the lead's interests and the needs
of their company.
This mail is the consequence of a first conversation. You have information available from that conversation in the
- SPIN-context (in between triple %)
- personal and company information (in between triple $)
Information might be missing however, as it might not be gathered in that first conversation.
Don't use any salutations or closing remarks, nor too complex sentences.
Our Company and Product:
- Company Name: {company}
- Products: {products}
- Product information: {product_information}
{customer_role}'s Identification:
$$${Identification}$$$
SPIN context:
%%%{SPIN}%%%
{custom_description}
expected_output: >
A personalized email draft that:
- Addresses the lead by name
- Acknowledges their role and company
- Highlights how {company} can meet their specific needs or interests
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "Email Drafting Task towards a Lead"
changes: "Initial version"

View File

@@ -0,0 +1,28 @@
version: "1.0.0"
name: "Email Lead Engagement Creation"
description: >
Review a personalized email and optimize it with strong CTAs and engagement hooks. Keep in mind that this email is
the consequence of a first conversation.
Don't use any salutations or closing remarks, nor too complex sentences. Keep it short and to the point.
Don't use any salutations or closing remarks, nor too complex sentences.
Ensure the email encourages the lead to schedule a meeting or take
another desired action immediately.
Our Company and Product:
- Company Name: {company}
- Products: {products}
- Product information: {product_information}
Engagement options:
{engagement_options}
{custom_description}
expected_output: >
An optimized email ready for sending, complete with:
- Strong CTAs
- Strategically placed engagement hooks that encourage immediate action
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "Make an Email draft more engaging"
changes: "Initial version"

View File

@@ -0,0 +1,16 @@
version: "1.0.0"
name: "Identification Gathering"
description: >
Detect and pass on identification information in the ongoing conversation, from within the following information:
{question}
Add to or refine the following already gathered identification information (between triple $)
$$${Identification}$$$
{custom_description}
expected_output: >
Identification information such as name, email, phone number, company, role, company website, ...
{custom_expected_output}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "A Task that gathers identification information from a conversation"
changes: "Initial version"

View File

@@ -0,0 +1,15 @@
version: "1.0.0"
name: "Define Identification Questions"
description: >
Ask questions to complete or confirm the identification information gathered.
Current Identification Information:
$$${Identification}$$$
{custom_description}
expected_output: >
Top 2 questions to ask in order to complete identification.
{custom_expected_output}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "A Task to define identification (person & company) questions"
changes: "Initial version"

View File

@@ -0,0 +1,23 @@
version: "1.0.0"
name: "RAG Task"
description: >
Answer the question based on the following context, delimited between triple backquotes, and taking into account
the history of the discussion, in between triple %
{custom_description}
Use the following {language} in your communication, and cite the sources used at the end of the full conversation.
If the question cannot be answered using the given context, say "I have insufficient information to answer this question."
Context:
```{context}```
History:
%%%{history}%%%
Question:
{question}
expected_output: >
An answer to the question asked formatted in markdown, without '```'.
A list of sources used in generating the answer.
An indication (True or False) of your ability to provide an answer.
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "A Task that gives RAG-based answers"
changes: "Initial version"

View File

@@ -0,0 +1,28 @@
version: "1.0.0"
name: "SPIN Information Detection"
description: >
Detect the SPIN-context, taking into account the history of the discussion (in between triple %) with main focus on
the latest reply (which can contain answers on previously asked questions by the user). Do not remove elements from
the known SPIN (in between triple $) analysis unless explicitly stated by the end user in the latest reply. In all other cases, refine the
current SPIN analysis or add elements to it.
{custom_description}
Use the following {tenant_language} to define the SPIN-elements. If no additional information can be added, just
return the already known SPIN.
History:
%%%{history}%%%
Known SPIN:
$$${SPIN}$$$
Latest reply:
{question}
expected_output: >
The SPIN analysis, comprised of:
- Situation information - Information to understanding the customer's current context, as a markdown list without '```'.
- Problem information - Information on uncovering the customer's challenges and pain points, as a markdown list without '```'.
- Implication information - Exploration of the consequences of those problems, as a markdown list without '```'.
- Need-payoff information - Helping customers realize value of solutions and defining their direct needs, as a markdown list without '```'.
{custom_expected_output}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "A Task that performs SPIN Information Detection"
changes: "Initial version"

View File

@@ -0,0 +1,26 @@
version: "1.0.0"
name: "SPIN Question Identification"
description: >
Define, taking into account the history of the discussion (in between triple %), the latest reply and the currently
known SPIN-elements (in between triple $), the top questions that need to be asked to understand the full SPIN context
of the customer. If you think this user could be a potential customer, please indicate so.
{custom_description}
Use the following {tenant_language} to define the SPIN-elements. If you have a full SPIN context, just skip and don't
ask for more information or confirmation.
History:
%%%{history}%%%
Known SPIN:
$$${SPIN}$$$
Latest reply:
{question}
expected_output: >
The SPIN questions:
- At max {nr_of_spin_questions} questions to complete the SPIN-context of the customer, as a markdown list without '```'.
Potential Customer Indication:
- An indication if - given the current SPIN - this could be a good customer (True) or not (False).
{custom_expected_output}
metadata:
author: "Josako"
date_added: "2025-01-08"
description: "A Task that identifies questions to complete the SPIN context in a conversation"
changes: "Initial version"

View File

@@ -0,0 +1,27 @@
# Agent Types
AGENT_TYPES = {
"EMAIL_CONTENT_AGENT": {
"name": "Email Content Agent",
"description": "An Agent that writes engaging emails.",
},
"EMAIL_ENGAGEMENT_AGENT": {
"name": "Email Engagement Agent",
"description": "An Agent that ensures the email is engaging and lead to maximal desired action",
},
"IDENTIFICATION_AGENT": {
"name": "Identification Agent",
"description": "An Agent that gathers identification information",
},
"RAG_AGENT": {
"name": "Rag Agent",
"description": "An Agent that does RAG based on a user's question, RAG content & history",
},
"SPIN_DETECTION_AGENT": {
"name": "SPIN Sales Assistant",
"description": "An Agent that detects SPIN information in an ongoing conversation",
},
"SPIN_SALES_SPECIALIST_AGENT": {
"name": "SPIN Sales Specialist",
"description": "An Agent that asks for Follow-up questions for SPIN-process",
},
}

View File

@@ -8,4 +8,8 @@ SERVICE_TYPES = {
"name": "DOCAPI",
"description": "Service allows to use document API functionality.",
},
"DEPLOY_API": {
"name": "DEPLOY_API",
"description": "Service allows to use deployment API functionality.",
}
}

View File

@@ -3,60 +3,9 @@ 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,
},
"temperature": {
"name": "Temperature",
"type": "number",
"description": "The inference temperature to be used by the specialist.",
"required": False,
"default": 0.3
}
},
"arguments": {
"language": {
"name": "Language",
"type": "str",
"description": "Language code to be used for receiving questions and giving answers",
"required": True,
},
"query": {
"name": "query",
"type": "str",
"description": "Query to answer",
"required": True,
}
},
"results": {
"detailed_query": {
"name": "detailed_query",
"type": "str",
"description": "The query detailed with the Chat Session History.",
"required": True,
},
"answer": {
"name": "answer",
"type": "str",
"description": "Answer to the query",
"required": True,
},
"citations": {
"name": "citations",
"type": "List[str]",
"description": "List of citations",
"required": False,
},
"insufficient_info": {
"name": "insufficient_info",
"type": "bool",
"description": "Whether or not the query is insufficient info",
"required": True,
},
}
},
"SPIN_SPECIALIST": {
"name": "Spin Sales Specialist",
"description": "A specialist that allows to answer user queries, try to get SPIN-information and Identification",
}
}

View File

@@ -0,0 +1,31 @@
# Agent Types
TASK_TYPES = {
"EMAIL_LEAD_DRAFTING_TASK": {
"name": "Email Lead Draft Creation",
"description": "Email Drafting Task towards a Lead",
},
"EMAIL_LEAD_ENGAGEMENT_TASK": {
"name": "Email Lead Engagement Creation",
"description": "Make an Email draft more engaging",
},
"IDENTIFICATION_DETECTION_TASK": {
"name": "Identification Gathering",
"description": "A Task that gathers identification information from a conversation",
},
"IDENTIFICATION_QUESTIONS_TASK": {
"name": "Define Identification Questions",
"description": "A Task to define identification (person & company) questions",
},
"RAG_TASK": {
"name": "RAG Task",
"description": "A Task that gives RAG-based answers",
},
"SPIN_DETECT_TASK": {
"name": "SPIN Information Detection",
"description": "A Task that performs SPIN Information Detection",
},
"SPIN_QUESTIONS_TASK": {
"name": "SPIN Question Identification",
"description": "A Task that identifies questions to complete the SPIN context in a conversation",
},
}

View File

@@ -0,0 +1,4 @@
# Agent Types
TOOL_TYPES = {
}