-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from lpm0073/next
add unit tests and refactor credentials
- Loading branch information
Showing
7 changed files
with
107 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
# pylint: disable=too-few-public-methods | ||
"""Sales Support Model (SSM) for the LangChain project.""" | ||
|
||
import os | ||
|
||
from dotenv import find_dotenv, load_dotenv | ||
|
||
|
||
# pylint: disable=duplicate-code | ||
dotenv_path = find_dotenv() | ||
if os.path.exists(dotenv_path): | ||
load_dotenv(dotenv_path=dotenv_path, verbose=True) | ||
OPENAI_API_KEY = os.environ["OPENAI_API_KEY"] | ||
OPENAI_API_ORGANIZATION = os.environ["OPENAI_API_ORGANIZATION"] | ||
PINECONE_API_KEY = os.environ["PINECONE_API_KEY"] | ||
PINECONE_ENVIRONMENT = os.environ["PINECONE_ENVIRONMENT"] | ||
PINECONE_INDEX_NAME = os.environ["PINECONE_INDEX_NAME"] | ||
else: | ||
raise FileNotFoundError("No .env file found in root directory of repository") | ||
|
||
|
||
class Credentials: | ||
"""Credentials.""" | ||
|
||
OPENAI_API_KEY = OPENAI_API_KEY | ||
OPENAI_API_ORGANIZATION = OPENAI_API_ORGANIZATION | ||
PINECONE_API_KEY = PINECONE_API_KEY | ||
PINECONE_ENVIRONMENT = PINECONE_ENVIRONMENT | ||
PINECONE_INDEX_NAME = PINECONE_INDEX_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
# pylint: disable=too-few-public-methods | ||
"""Sales Support Model (SSM) prompt templates""" | ||
|
||
from langchain.prompts import PromptTemplate | ||
|
||
|
||
class NetecPromptTemplates: | ||
"""Netec Prompt Templates.""" | ||
|
||
sales_role: str = """You are a helpful sales assistant at Netec who sells | ||
specialized training and exam preparation services to existing customers. | ||
You provide concise explanations of the services that Netec offers in 100 | ||
words or less.""" | ||
|
||
@classmethod | ||
def get_properties(cls): | ||
"""return a list of properties of this class.""" | ||
return [attr for attr in dir(cls) if isinstance(getattr(cls, attr), property)] | ||
|
||
@property | ||
def training_services(self) -> PromptTemplate: | ||
"""Get prompt.""" | ||
template = ( | ||
self.sales_role | ||
+ """ | ||
Explain the training services that Netec offers about {concept} | ||
""" | ||
) | ||
return PromptTemplate(input_variables=["concept"], template=template) | ||
|
||
@property | ||
def oracle_training_services(self) -> PromptTemplate: | ||
"""Get prompt.""" | ||
template = ( | ||
self.sales_role | ||
+ """ | ||
Note that Netec is the exclusive provide of Oracle training services | ||
for the 6 levels of Oracle Certification credentials: Oracle Certified Junior Associate (OCJA), | ||
Oracle Certified Associate (OCA), Oracle Certified Professional (OCP), | ||
Oracle Certified Master (OCM), Oracle Certified Expert (OCE) and | ||
Oracle Certified Specialist (OCS). | ||
Summarize their programs for {concept} | ||
""" | ||
) | ||
return PromptTemplate(input_variables=["concept"], template=template) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters