Add OS Info into the initial prompt (#2587)
parent
a2e16695af
commit
9dcdb6d6f8
|
@ -5,9 +5,11 @@ A module that contains the AIConfig class object that contains the configuration
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional, Type
|
from typing import Optional, Type
|
||||||
|
|
||||||
|
import distro
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from autogpt.prompts.generator import PromptGenerator
|
from autogpt.prompts.generator import PromptGenerator
|
||||||
|
@ -130,6 +132,17 @@ class AIConfig:
|
||||||
continue
|
continue
|
||||||
prompt_generator = plugin.post_prompt(prompt_generator)
|
prompt_generator = plugin.post_prompt(prompt_generator)
|
||||||
|
|
||||||
|
if cfg.execute_local_commands:
|
||||||
|
# add OS info to prompt
|
||||||
|
os_name = platform.system()
|
||||||
|
os_info = (
|
||||||
|
platform.platform(terse=True)
|
||||||
|
if os_name != "Linux"
|
||||||
|
else distro.name(pretty=True)
|
||||||
|
)
|
||||||
|
|
||||||
|
prompt_start += f"\nThe OS you are running on is: {os_info}"
|
||||||
|
|
||||||
# Construct full prompt
|
# Construct full prompt
|
||||||
full_prompt = f"You are {prompt_generator.name}, {prompt_generator.role}\n{prompt_start}\n\nGOALS:\n\n"
|
full_prompt = f"You are {prompt_generator.name}, {prompt_generator.role}\n{prompt_start}\n\nGOALS:\n\n"
|
||||||
for i, goal in enumerate(self.ai_goals):
|
for i, goal in enumerate(self.ai_goals):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
beautifulsoup4>=4.12.2
|
beautifulsoup4>=4.12.2
|
||||||
colorama==0.4.6
|
colorama==0.4.6
|
||||||
|
distro==1.8.0
|
||||||
openai==0.27.2
|
openai==0.27.2
|
||||||
playsound==1.2.2
|
playsound==1.2.2
|
||||||
python-dotenv==1.0.0
|
python-dotenv==1.0.0
|
||||||
|
|
Loading…
Reference in New Issue