diff --git a/docs/_snippets/missing-data-source-tip.mdx b/docs/_snippets/missing-data-source-tip.mdx index bd87379a..e76a29b1 100644 --- a/docs/_snippets/missing-data-source-tip.mdx +++ b/docs/_snippets/missing-data-source-tip.mdx @@ -1,6 +1,9 @@

If you can't find the specific data source, please feel free to request through one of the following channels and help us prioritize.

+ + Fill out this form + Let us know on our slack community diff --git a/docs/api-reference/pipeline/delete.mdx b/docs/api-reference/pipeline/delete.mdx new file mode 100644 index 00000000..c4ddb595 --- /dev/null +++ b/docs/api-reference/pipeline/delete.mdx @@ -0,0 +1,19 @@ +--- +title: 🗑 delete +--- + +`delete_chat_history()` method allows you to delete all previous messages in a chat history. + +## Usage + +```python +from embedchain import Pipeline as App + +app = App() + +app.add("https://www.forbes.com/profile/elon-musk") + +app.chat("What is the net worth of Elon Musk?") + +app.delete_chat_history() +``` \ No newline at end of file diff --git a/docs/api-reference/pipeline/reset.mdx b/docs/api-reference/pipeline/reset.mdx index df697b19..d3fa59a3 100644 --- a/docs/api-reference/pipeline/reset.mdx +++ b/docs/api-reference/pipeline/reset.mdx @@ -14,4 +14,4 @@ app.add("https://www.forbes.com/profile/elon-musk") # Reset the app app.reset() -``` +``` \ No newline at end of file diff --git a/docs/get-started/faq.mdx b/docs/get-started/faq.mdx index 096a7330..15516685 100644 --- a/docs/get-started/faq.mdx +++ b/docs/get-started/faq.mdx @@ -4,7 +4,7 @@ description: 'Collections of all the frequently asked questions' --- -Yes, it does. Please refer to the [OpenAI Assistant docs page](/get-started/openai-assistant). +Yes, it does. Please refer to the [OpenAI Assistant docs page](/examples/openai-assistant). Use the model provided on huggingface: `mistralai/Mistral-7B-v0.1` @@ -116,6 +116,36 @@ embedder: ``` + + +You can achieve this by setting `stream` to `true` in the config file. + + +```yaml openai.yaml +llm: + provider: openai + config: + model: 'gpt-3.5-turbo' + temperature: 0.5 + max_tokens: 1000 + top_p: 1 + stream: true +``` + +```python main.py +import os +from embedchain import Pipeline as App + +os.environ['OPENAI_API_KEY'] = 'sk-xxx' + +app = App.from_config(config_path="openai.yaml") + +app.add("https://www.forbes.com/profile/elon-musk") + +response = app.query("What is the net worth of Elon Musk?") +# response will be streamed in stdout as it is generated. +``` + diff --git a/docs/mint.json b/docs/mint.json index aef640ee..257a73bc 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -183,7 +183,8 @@ "api-reference/pipeline/chat", "api-reference/pipeline/search", "api-reference/pipeline/deploy", - "api-reference/pipeline/reset" + "api-reference/pipeline/reset", + "api-reference/pipeline/delete" ] }, "api-reference/store/openai-assistant", @@ -233,5 +234,11 @@ }, "api": { "baseUrl": "http://localhost:8080" - } + }, + "redirects": [ + { + "source": "/changelog/command-line", + "destination": "/get-started/introduction" + } + ] } \ No newline at end of file diff --git a/embedchain/embedchain.py b/embedchain/embedchain.py index 0fa4c84b..e4144545 100644 --- a/embedchain/embedchain.py +++ b/embedchain/embedchain.py @@ -650,7 +650,7 @@ class EmbedChain(JSONSerializable): self.db.reset() self.cursor.execute("DELETE FROM data_sources WHERE pipeline_id = ?", (self.config.id,)) self.connection.commit() - self.delete_history() + self.delete_chat_history() # Send anonymous telemetry self.telemetry.capture(event_name="reset", properties=self._telemetry_props) @@ -661,5 +661,6 @@ class EmbedChain(JSONSerializable): display_format=display_format, ) - def delete_history(self): + def delete_chat_history(self): self.llm.memory.delete_chat_history(app_id=self.config.id) + self.llm.update_history(app_id=self.config.id) diff --git a/embedchain/llm/base.py b/embedchain/llm/base.py index b5daec30..523bbf82 100644 --- a/embedchain/llm/base.py +++ b/embedchain/llm/base.py @@ -48,8 +48,7 @@ class BaseLlm(JSONSerializable): def update_history(self, app_id: str): """Update class history attribute with history in memory (for chat method)""" chat_history = self.memory.get_recent_memories(app_id=app_id, num_rounds=10) - if chat_history: - self.set_history([str(history) for history in chat_history]) + self.set_history([str(history) for history in chat_history]) def add_history(self, app_id: str, question: str, answer: str, metadata: Optional[Dict[str, Any]] = None): chat_message = ChatMessage()