From c8fe101221a29e859ee3049fd8e5a7f1591a43e4 Mon Sep 17 00:00:00 2001 From: cosmofactory Date: Thu, 19 Oct 2023 20:10:04 +0200 Subject: [PATCH 1/3] langsmith connected --- .gitignore | 4 ++++ run.py | 8 +++++++- salesgpt/agents.py | 12 ++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index fdb83895..629f6f8b 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,7 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST + +# environmental +**venv +litellm_uuid.txt \ No newline at end of file diff --git a/run.py b/run.py index b44b7a7b..0957f4e8 100644 --- a/run.py +++ b/run.py @@ -1,5 +1,6 @@ import argparse import json +import os from dotenv import load_dotenv from langchain.chat_models import ChatLiteLLM @@ -8,6 +9,11 @@ load_dotenv() # loads .env file +os.environ["LANGCHAIN_TRACING_V2"] = "true" +os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" +os.environ["LANGCHAIN_API_KEY"] = os.getenv("LANGCHAIN_SMITH_API_KEY") +os.environ["LANGCHAIN_PROJECT"] = 'pt-pertinent-discount-40' + if __name__ == "__main__": # Initialize argparse @@ -45,7 +51,7 @@ llm, use_tools=USE_TOOLS, product_catalog="examples/sample_product_catalog.txt", - salesperson_name="Ted Lasso", + salesperson_name="Octavio Arroyo", verbose=verbose, ) else: diff --git a/salesgpt/agents.py b/salesgpt/agents.py index fcc4b74b..20722e2b 100644 --- a/salesgpt/agents.py +++ b/salesgpt/agents.py @@ -46,12 +46,12 @@ class SalesGPT(Chain): model_name: str = "gpt-3.5-turbo-0613" use_tools: bool = False - salesperson_name: str = "Ted Lasso" - salesperson_role: str = "Business Development Representative" - company_name: str = "Sleep Haven" - company_business: str = "Sleep Haven is a premium mattress company that provides customers with the most comfortable and supportive sleeping experience possible. We offer a range of high-quality mattresses, pillows, and bedding accessories that are designed to meet the unique needs of our customers." - company_values: str = "Our mission at Sleep Haven is to help people achieve a better night's sleep by providing them with the best possible sleep solutions. We believe that quality sleep is essential to overall health and well-being, and we are committed to helping our customers achieve optimal sleep by offering exceptional products and customer service." - conversation_purpose: str = "find out whether they are looking to achieve better sleep via buying a premier mattress." + salesperson_name: str = "Octavio Arroyo" + salesperson_role: str = "Friendly and well-known figure in Peru, subtly guiding the Human to purchase a course of Cardiox" + company_name: str = "HeartGuard Solutions" + company_business: str = "HeartGuard Solutions is a leading health supplement company specializing in natural products designed to support heart health. With our flagship product, Cardiox, we aim to provide a natural remedy for those suffering from hypertension and those who wish to maintain a healthy heart." + company_values: str = "At HeartGuard Solutions, our mission is to empower individuals to take control of their heart health. We believe that with the right natural supplements, everyone can lead a life free from the worries of heart-related ailments. We're committed to rigorous research and ensuring that our customers receive only the highest quality products to support their well-being." + conversation_purpose: str = "Educate about the benefits of Cardiox, discuss any heart-related concerns, and guide them towards making an informed decision about their heart health." conversation_type: str = "call" def retrieve_conversation_stage(self, key): From 722a8ff1101139b8d4bfce8152c9dd847bfbf2f1 Mon Sep 17 00:00:00 2001 From: cosmofactory Date: Mon, 23 Oct 2023 15:57:05 +0200 Subject: [PATCH 2/3] added langsmith and readme --- README.md | 18 ++++++++++++++++++ run.py | 9 +++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 816a3720..249cca50 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,24 @@ Please refer to [README-api.md](https://github.com/filip-michalsky/SalesGPT/blob All tests should pass. +## LangSmith tracing + +LangSmith is a platform for building production-grade LLM applications. + +It lets you debug, test, evaluate, and monitor chains and intelligent agents built on any LLM framework and seamlessly integrates with LangChain, the go-to open source framework for building with LLMs. + +LangSmith is developed by LangChain, the company behind the open source LangChain framework. + +To switch on the LangSmith tracing you have to do the following steps: + +1. [Create a LangSmith account](https://smith.langchain.com/) +2. [Create an API key in settings](https://smith.langchain.com/settings) +3. Add you API key and Project name from LangSmith account to .env file or run.py module +4. Switch on the "LANGCHAIN_TRACING_V2" setting in run.py to "true" +5. That's it. You'll get better understanding of your agents and chaing performance in LangChain admin panel. + +For futher reading take a look at the [docs](https://docs.smith.langchain.com/) + ## Contact Us For questions, you can [contact the repo author](mailto:filipmichalsky@gmail.com). diff --git a/run.py b/run.py index 0957f4e8..0c9200a3 100644 --- a/run.py +++ b/run.py @@ -9,10 +9,12 @@ load_dotenv() # loads .env file -os.environ["LANGCHAIN_TRACING_V2"] = "true" +# LangSmith settings section, set TRACING_V2 to "true" to enable it +# or leave it as it is, if you don't need tracing (more info in README) +os.environ["LANGCHAIN_TRACING_V2"] = "false" os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com" os.environ["LANGCHAIN_API_KEY"] = os.getenv("LANGCHAIN_SMITH_API_KEY") -os.environ["LANGCHAIN_PROJECT"] = 'pt-pertinent-discount-40' +os.environ["LANGCHAIN_PROJECT"] = "" # insert you project name here if __name__ == "__main__": @@ -23,8 +25,7 @@ parser.add_argument( "--config", type=str, help="Path to agent config file", default="" ) - parser.add_argument("--verbose", type=bool, help="Verbosity", - default=False) + parser.add_argument("--verbose", type=bool, help="Verbosity", default=False) parser.add_argument( "--max_num_turns", type=int, From 259fe0b5a90c05640de6839d27f908b6cffe8b97 Mon Sep 17 00:00:00 2001 From: cosmofactory Date: Mon, 23 Oct 2023 16:11:51 +0200 Subject: [PATCH 3/3] added langsmith and readme --- .gitignore | 2 ++ run.py | 6 ++++-- salesgpt/agents.py | 12 ++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 629f6f8b..6193041e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,6 @@ MANIFEST # environmental **venv + +# generated litellm_uuid.txt \ No newline at end of file diff --git a/run.py b/run.py index 0c9200a3..6a4e072e 100644 --- a/run.py +++ b/run.py @@ -25,7 +25,9 @@ parser.add_argument( "--config", type=str, help="Path to agent config file", default="" ) - parser.add_argument("--verbose", type=bool, help="Verbosity", default=False) + parser.add_argument( + "--verbose", type=bool, help="Verbosity", default=False + ) parser.add_argument( "--max_num_turns", type=int, @@ -52,7 +54,7 @@ llm, use_tools=USE_TOOLS, product_catalog="examples/sample_product_catalog.txt", - salesperson_name="Octavio Arroyo", + salesperson_name="Ted Lasso", verbose=verbose, ) else: diff --git a/salesgpt/agents.py b/salesgpt/agents.py index 20722e2b..fcc4b74b 100644 --- a/salesgpt/agents.py +++ b/salesgpt/agents.py @@ -46,12 +46,12 @@ class SalesGPT(Chain): model_name: str = "gpt-3.5-turbo-0613" use_tools: bool = False - salesperson_name: str = "Octavio Arroyo" - salesperson_role: str = "Friendly and well-known figure in Peru, subtly guiding the Human to purchase a course of Cardiox" - company_name: str = "HeartGuard Solutions" - company_business: str = "HeartGuard Solutions is a leading health supplement company specializing in natural products designed to support heart health. With our flagship product, Cardiox, we aim to provide a natural remedy for those suffering from hypertension and those who wish to maintain a healthy heart." - company_values: str = "At HeartGuard Solutions, our mission is to empower individuals to take control of their heart health. We believe that with the right natural supplements, everyone can lead a life free from the worries of heart-related ailments. We're committed to rigorous research and ensuring that our customers receive only the highest quality products to support their well-being." - conversation_purpose: str = "Educate about the benefits of Cardiox, discuss any heart-related concerns, and guide them towards making an informed decision about their heart health." + salesperson_name: str = "Ted Lasso" + salesperson_role: str = "Business Development Representative" + company_name: str = "Sleep Haven" + company_business: str = "Sleep Haven is a premium mattress company that provides customers with the most comfortable and supportive sleeping experience possible. We offer a range of high-quality mattresses, pillows, and bedding accessories that are designed to meet the unique needs of our customers." + company_values: str = "Our mission at Sleep Haven is to help people achieve a better night's sleep by providing them with the best possible sleep solutions. We believe that quality sleep is essential to overall health and well-being, and we are committed to helping our customers achieve optimal sleep by offering exceptional products and customer service." + conversation_purpose: str = "find out whether they are looking to achieve better sleep via buying a premier mattress." conversation_type: str = "call" def retrieve_conversation_stage(self, key):