Skip to content

Commit

Permalink
api update
Browse files Browse the repository at this point in the history
  • Loading branch information
chemik-bit committed Feb 15, 2024
1 parent a9fe81f commit 2eac7f5
Show file tree
Hide file tree
Showing 9 changed files with 195 additions and 32 deletions.
Binary file modified api-website/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified api-website/_build/doctrees/salesgpt/salesgpt.agents.doctree
Binary file not shown.
Binary file modified api-website/_build/doctrees/salesgpt/salesgpt.logger.doctree
Binary file not shown.
Binary file modified api-website/_build/html/objects.inv
Binary file not shown.
5 changes: 5 additions & 0 deletions api-website/_build/html/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ <h1>Python Module Index</h1>
<td>&#160;&#160;&#160;
<a href="salesgpt/salesgpt.chains.html#module-salesgpt.chains"><code class="xref">salesgpt.chains</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="salesgpt/salesgpt.logger.html#module-salesgpt.logger"><code class="xref">salesgpt.logger</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
Expand Down
147 changes: 130 additions & 17 deletions api-website/_build/html/salesgpt/salesgpt.agents.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,28 +127,68 @@
<dl class="py method">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.acall">
<span class="sig-name descname"><span class="pre">acall</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#salesgpt.agents.SalesGPT.acall" title="Link to this definition"></a></dt>
<dd><p>This method is not implemented yet.</p>
<dd><p>This method is currently not implemented.</p>
<section id="parameters">
<h2>Parameters<a class="headerlink" href="#parameters" title="Link to this heading"></a></h2>
<dl class="simple">
<dt>Args:</dt><dd><p>*args: Variable length argument list.
**kwargs: Arbitrary keyword arguments.</p>
<dt>*args<span class="classifier">tuple</span></dt><dd><p>Variable length argument list.</p>
</dd>
<dt>Raises:</dt><dd><p>NotImplementedError: This method has not been implemented yet.</p>
<dt>**kwargs<span class="classifier">dict</span></dt><dd><p>Arbitrary keyword arguments.</p>
</dd>
</dl>
</section>
<section id="raises">
<h2>Raises<a class="headerlink" href="#raises" title="Link to this heading"></a></h2>
<dl class="simple">
<dt>NotImplementedError</dt><dd><p>Indicates that this method has not been implemented yet.</p>
</dd>
</dl>
</section>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.acompletion_with_retry">
<em class="property"><span class="pre">async</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">acompletion_with_retry</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">llm</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Any</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Any</span></span></span><a class="headerlink" href="#salesgpt.agents.SalesGPT.acompletion_with_retry" title="Link to this definition"></a></dt>
<dd><p>Use tenacity to retry the async completion call.</p>
<p>This method uses the tenacity library to retry the asynchronous completion call in case of failure.
It creates a retry decorator using the ‘_create_retry_decorator’ method and applies it to the
‘_completion_with_retry’ function which makes the actual asynchronous completion call.</p>
<section id="id1">
<h2>Parameters<a class="headerlink" href="#id1" title="Link to this heading"></a></h2>
<dl class="simple">
<dt>llm<span class="classifier">Any</span></dt><dd><p>The language model to be used for the completion.</p>
</dd>
<dt>**kwargs<span class="classifier">Any</span></dt><dd><p>Additional keyword arguments to be passed to the completion function.</p>
</dd>
</dl>
</section>
<section id="returns">
<h2>Returns<a class="headerlink" href="#returns" title="Link to this heading"></a></h2>
<dl class="simple">
<dt>Any</dt><dd><p>The result of the completion function call.</p>
</dd>
</dl>
</section>
<section id="id2">
<h2>Raises<a class="headerlink" href="#id2" title="Link to this heading"></a></h2>
<dl class="simple">
<dt>Exception</dt><dd><p>If the completion function call fails after the maximum number of retries.</p>
</dd>
</dl>
</section>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.astep">
<span class="sig-name descname"><span class="pre">astep</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#salesgpt.agents.SalesGPT.astep" title="Link to this definition"></a></dt>
<dd><dl class="simple">
<dt>Args:</dt><dd><p>stream (bool): whether or not return
streaming generator object to manipulate streaming chunks in downstream applications.</p>
<dd><p>Executes an asynchronous step in the conversation.</p>
<p>If the stream argument is set to False, it calls the _acall method with an empty dictionary as input.
If the stream argument is set to True, it returns a streaming generator object for manipulating streaming chunks in downstream applications.</p>
<dl class="simple">
<dt>Args:</dt><dd><p>stream (bool, optional): A flag indicating whether to return a streaming generator object.
Defaults to False.</p>
</dd>
<dt>Returns:</dt><dd><p>Generator: A streaming generator object if stream is set to True. Otherwise, it returns None.</p>
</dd>
</dl>
</dd></dl>
Expand Down Expand Up @@ -201,23 +241,70 @@
<dl class="py method">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.determine_conversation_stage">
<span class="sig-name descname"><span class="pre">determine_conversation_stage</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#salesgpt.agents.SalesGPT.determine_conversation_stage" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dd><p>Determines the current conversation stage based on the conversation history.</p>
<p>This method uses the stage_analyzer_chain to analyze the conversation history and determine the current stage.
The conversation history is joined into a single string, with each entry separated by a newline character.
The current conversation stage ID is also passed to the stage_analyzer_chain.</p>
<p>The method then prints the determined conversation stage ID and retrieves the corresponding conversation stage
from the conversation_stage_dict dictionary using the retrieve_conversation_stage method.</p>
<p>Finally, the method prints the determined conversation stage.</p>
<dl class="simple">
<dt>Returns:</dt><dd><p>None</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.from_llm">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_llm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">llm</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">ChatLiteLLM</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">verbose</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#salesgpt.agents.SalesGPT" title="salesgpt.agents.SalesGPT"><span class="pre">SalesGPT</span></a></span></span><a class="headerlink" href="#salesgpt.agents.SalesGPT.from_llm" title="Link to this definition"></a></dt>
<dd><p>Initialize the SalesGPT Controller.</p>
<dd><p>Class method to initialize the SalesGPT Controller from a given ChatLiteLLM instance.</p>
<p>This method sets up the stage analyzer chain and sales conversation utterance chain. It also checks if custom prompts
are to be used and if tools are to be set up for the agent. If tools are to be used, it sets up the knowledge base,
gets the tools, sets up the prompt, and initializes the agent with the tools. If tools are not to be used, it sets
the sales agent executor and knowledge base to None.</p>
<section id="id3">
<h2>Parameters<a class="headerlink" href="#id3" title="Link to this heading"></a></h2>
<dl class="simple">
<dt>llm<span class="classifier">ChatLiteLLM</span></dt><dd><p>The ChatLiteLLM instance to initialize the SalesGPT Controller from.</p>
</dd>
<dt>verbose<span class="classifier">bool, optional</span></dt><dd><p>If True, verbose output is enabled. Default is False.</p>
</dd>
<dt>**kwargs<span class="classifier">dict</span></dt><dd><p>Additional keyword arguments.</p>
</dd>
</dl>
</section>
<section id="id4">
<h2>Returns<a class="headerlink" href="#id4" title="Link to this heading"></a></h2>
<dl class="simple">
<dt>SalesGPT</dt><dd><p>The initialized SalesGPT Controller.</p>
</dd>
</dl>
</section>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.human_step">
<span class="sig-name descname"><span class="pre">human_step</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">human_input</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#salesgpt.agents.SalesGPT.human_step" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dd><p>Processes the human input and appends it to the conversation history.</p>
<p>This method takes the human input as a string, formats it by adding “User: ” at the beginning and ” &lt;END_OF_TURN&gt;” at the end, and then appends this formatted string to the conversation history.</p>
<dl class="simple">
<dt>Args:</dt><dd><p>human_input (str): The input string from the human user.</p>
</dd>
<dt>Returns:</dt><dd><p>None</p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.input_keys">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">input_keys</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#salesgpt.agents.SalesGPT.input_keys" title="Link to this definition"></a></dt>
<dd><p>Keys expected to be in the chain input.</p>
<dd><p>Property that returns a list of input keys.</p>
<p>This property is currently set to return an empty list. It can be overridden in a subclass to return a list of keys
that are used to extract input data from a dictionary.</p>
<dl class="simple">
<dt>Returns:</dt><dd><p>List[str]: An empty list.</p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
Expand All @@ -233,13 +320,28 @@
<dl class="py property">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.output_keys">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">output_keys</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#salesgpt.agents.SalesGPT.output_keys" title="Link to this definition"></a></dt>
<dd><p>Keys expected to be in the chain output.</p>
<dd><p>Property that returns a list of output keys.</p>
<p>This property is currently set to return an empty list. It can be overridden in a subclass to return a list of keys
that are used to extract output data from a dictionary.</p>
<dl class="simple">
<dt>Returns:</dt><dd><p>List[str]: An empty list.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.retrieve_conversation_stage">
<span class="sig-name descname"><span class="pre">retrieve_conversation_stage</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#salesgpt.agents.SalesGPT.retrieve_conversation_stage" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dd><p>Retrieves the conversation stage based on the provided key.</p>
<p>This function uses the key to look up the corresponding conversation stage in the conversation_stage_dict dictionary.
If the key is not found in the dictionary, it defaults to “1”.</p>
<dl class="simple">
<dt>Args:</dt><dd><p>key (str): The key to look up in the conversation_stage_dict dictionary.</p>
</dd>
<dt>Returns:</dt><dd><p>str: The conversation stage corresponding to the key, or “1” if the key is not found.</p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.sales_agent_executor">
Expand All @@ -264,7 +366,13 @@
<dl class="py method">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.seed_agent">
<span class="sig-name descname"><span class="pre">seed_agent</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#salesgpt.agents.SalesGPT.seed_agent" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dd><p>This method seeds the conversation by setting the initial conversation stage and clearing the conversation history.</p>
<p>The initial conversation stage is retrieved using the key “1”. The conversation history is reset to an empty list.</p>
<dl class="simple">
<dt>Returns:</dt><dd><p>None</p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.stage_analyzer_chain">
Expand All @@ -274,9 +382,14 @@
<dl class="py method">
<dt class="sig sig-object py" id="salesgpt.agents.SalesGPT.step">
<span class="sig-name descname"><span class="pre">step</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#salesgpt.agents.SalesGPT.step" title="Link to this definition"></a></dt>
<dd><dl class="simple">
<dt>Args:</dt><dd><p>stream (bool): whether or not return
streaming generator object to manipulate streaming chunks in downstream applications.</p>
<dd><p>Executes a step in the conversation. If the stream argument is set to True,
it returns a streaming generator object for manipulating streaming chunks in downstream applications.
If the stream argument is set to False, it calls the _call method with an empty dictionary as input.</p>
<dl class="simple">
<dt>Args:</dt><dd><p>stream (bool, optional): A flag indicating whether to return a streaming generator object.
Defaults to False.</p>
</dd>
<dt>Returns:</dt><dd><p>Generator: A streaming generator object if stream is set to True. Otherwise, it returns None.</p>
</dd>
</dl>
</dd></dl>
Expand Down
Loading

0 comments on commit 2eac7f5

Please sign in to comment.