Fix Agent API (#5483)

* Fix agent.yml for new modules

* Fix ConversationalAgent docstrings
This commit is contained in:
Bilge Yücel 2023-08-01 17:05:13 +03:00 committed by GitHub
parent 540d0fad97
commit 37bdfddff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -6,6 +6,8 @@ loaders:
processors:
- type: filter
expression: "name not in ['print_text']"
- type: filter
expression:
documented_only: true
do_not_filter_modules: false
skip_empty_modules: true

View File

@ -17,14 +17,15 @@ class ConversationalAgent(Agent):
If no tools are provided, the agent will be initialized to have a basic chat application.
Here is an example how you can create a chat application with tools:
```python
import os
from haystack.agents.conversational import ConversationalAgent
from haystack.nodes import PromptNode
from haystack.agents.base import ToolsManager, Tool
from haystack.agents.base import Tool
# Initialize a PromptNode and a ToolsManager with the desired tools
# Initialize a PromptNode and the desired tools
prompt_node = PromptNode("gpt-3.5-turbo", api_key=os.environ.get("OPENAI_API_KEY"), max_length=256)
tools = [Tool(name="ExampleTool", pipeline_or_node=example_tool_node)]
@ -38,10 +39,11 @@ class ConversationalAgent(Agent):
break
else:
assistant_response = agent.run(user_input)
print("\nAssistant:", assistant_response)
print("Assistant:", assistant_response)
```
If you don't want to have any tools in your chat app, you can create a ConversationalAgent only with a PromptNode:
```python
import os