Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Use LangChain or Agent Mode #19

Open
diskun00 opened this issue Feb 16, 2024 · 2 comments
Open

How to Use LangChain or Agent Mode #19

diskun00 opened this issue Feb 16, 2024 · 2 comments

Comments

@diskun00
Copy link

diskun00 commented Feb 16, 2024

Hi Marcin,

Thank you for creating this nice app! After worked with Langchain Agent last year, I was always looking forward to set up a local agent in my own laptop. Different from what I built in jupyter notebook, to have a UI for convenient interaction with the agent is really essential. I am so happy to see your project.

While setup agent mode, I find it not clear how to make it work. Could you give an example config? For example,
i want to set up an agent

  1. which can access browser
  2. use python
  3. run bash commands

I saw your implemented plugins covered all. But how could i configure it in PyGPT? I used to code an LangChain anget and expose those plugins as functions with description so that agent knows which and how to utilize them.

Besides, I am unable to find setting panel but only see it in the first launch of the app. FYI, I run it using clone repo from M2 MBP. I think maybe if i can access the settings page, i might figure it out the problem as well.
image

Thank you again!

@szczyglis-dev
Copy link
Owner

szczyglis-dev commented Feb 16, 2024

Hi ;)

The agent mode works very similarly here to what you described, but all the configuration for this is in the settings (Plugins -> Settings and Config -> Settings) which you don't see in the menu.

This will be a problem related to MacOS trying to manage menu items with specific names in its own way, when mapping them to a global menu:

https://doc.qt.io/qt-5/qmenubar.html#qmenubar-as-a-global-menu-bar

To resolve this, in the current release (2.0.152), I removed all roles for menu items that are specially treated by MacOS, such as Settings, About, or Exit. This trick should help - please check if both Settings options now appear correctly in the menu and give me a feedback - if this doesn't help, I will try to solve it in another way.


How to use Agents:

  • Choose the mode for the Agent (Chat is default) in Config -> Settings -> Agent - Agent mode is just a virtual mode which runs another mode (like Chat) in a loop
  • Enable the plugins you want to use, configure them (API keys, etc.) in Plugins -> Settings and enable the Execute commands checkbox to enable executing commands from plugins
  • Switch into Agent mode, choose the number of iterations (0 = infinity),
  • Choose the default system prompt to handle the Agent or create a new one
  • Send the input prompt with the goal to achieve - the Agent will work in a loop until the specified goal is reached
  • You can also use the plugin Autonomous in any non-Agent mode to run Agent-mode inline (it works similarly to Agent mode, but in standard modes like Chat)

Langchain:

  • At this moment, there are not too many wrappers for Langchain - by default, you can use OpenAI or HuggingFace wrappers
  • The model used for Langchain must be configured in the Config -> Models dialog - all the options required for the Langchain wrapper (like API key, etc.) must be provided on the list
  • All provided options will be passed directly to the Langchain wrapper as their kwargs
  • By default, there are configurations only for OpenAI models
  • You can also create your own wrapper and register it into the app (see the Managing Models section in Docs)

Hope this helps ;)

@diskun00
Copy link
Author

Thank you for quick reply! Now i could see the setting after the pulling the code.
Will check other features later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants