Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2023-11-21

### Added

- Mysql integration for data management, including runtime interactive data and running records.
- Redis integration for managing the state of components during interaction processes.
- Docker and initialization for Mysql and Redis included within the project setup.
- New exception handling processes, with custom exception classes for different runtime errors.
- Session sharing feature, allowing users to share their sessions with the community.
- Tuna mirror of debian.([#206](https://github.com/OpenBMB/XAgent/issues/206))

### Changed

- Removed some global variables, now using `XAgent.core.XAgentCoreComponents` for better modularity and encapsulation.
- Overhauled the project structure of XAgentServer for improved organization and maintainability.

### Removed

- XAgentIO.
- Local file storage mode and its support mechanisms.

### Fixed

- Fix various bugs in `XAgentServer` as reported in project issues.

## [0.1.0] - 2023-10-16

- Initial setup and integration of the `Toolserver`, `XAgent`, `XAgentIO`, `XAgentServer`, and `XAgentWeb` components.
201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

2 changes: 1 addition & 1 deletion XAgent/agent/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ def dispatch(
return agent


agent_dispatcher = XAgentDispatcher(CONFIG, enable=False)
# agent_dispatcher = XAgentDispatcher(CONFIG, enable=False)
2 changes: 1 addition & 1 deletion XAgent/ai_functions/request/obj_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def validate():
if not isinstance(arguments,str):
arguments = json5.dumps(arguments)
# give one opportunity to fix the json string
response = self.dynamic_json_fixes(arguments,function_schema,messages,str(e))
response = self.dynamic_json_fixs(arguments,function_schema,messages,str(e))
arguments = response['choices'][0]['message']['function_call']['arguments']
validate()

Expand Down
22 changes: 15 additions & 7 deletions XAgent/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import yaml
from copy import deepcopy


class XAgentConfig(dict):
"""
A dictionary-like configuration class with attribute-style access.

Inherited from dictionary, this class provides methods for accessing and modifying
dictionary items using attributes and methods.
"""

def __init__(self, *args, **kwargs):
"""
Initialize class instance.
Expand Down Expand Up @@ -75,7 +77,7 @@ def to_dict(self, safe=False):
"""
if safe:
right_value = deepcopy(self)
right_value.pop("api_keys","")
right_value.pop("api_keys", "")
return right_value
else:
return self
Expand All @@ -91,12 +93,14 @@ def reload(self, config_file='assets/config.yml'):
"""
config_file = os.getenv('CONFIG_FILE', config_file)
print('---config file---\n'+str(config_file))
self.__init__(**yaml.load(open(config_file, 'r'), Loader=yaml.FullLoader))
self.__init__(
**yaml.load(open(config_file, 'r'), Loader=yaml.FullLoader))
# check environment variables
self['selfhost_toolserver_url'] = os.getenv('TOOLSERVER_URL', self['selfhost_toolserver_url'])
self['selfhost_toolserver_url'] = os.getenv(
'TOOLSERVER_URL', self['selfhost_toolserver_url'])
print('---args---\n'+str(ARGS))
self.update(ARGS)

@staticmethod
def get_default_config(config_file='assets/config.yml'):
"""
Expand All @@ -116,10 +120,12 @@ def get_default_config(config_file='assets/config.yml'):
cfg = {}
return XAgentConfig(**cfg)


CONFIG = XAgentConfig.get_default_config()
ARGS = {}

def get_model_name(model_name:str=None):

def get_model_name(model_name: str = None):
"""
Get the normalized model name for a given input model name.

Expand All @@ -143,7 +149,7 @@ def get_model_name(model_name:str=None):
normalized_model_name = 'gpt-4-32k'
case 'gpt-3.5-turbo-16k':
normalized_model_name = 'gpt-3.5-turbo-16k'

case 'gpt4':
normalized_model_name = 'gpt-4'
case 'gpt4-32':
Expand All @@ -157,6 +163,7 @@ def get_model_name(model_name:str=None):

return normalized_model_name


def get_apiconfig_by_model(model_name: str) -> dict:
"""
Get API configuration for a model by its name.
Expand All @@ -172,5 +179,6 @@ def get_apiconfig_by_model(model_name: str) -> dict:
"""
normalized_model_name = get_model_name(model_name)
apiconfig = deepcopy(CONFIG.api_keys[normalized_model_name][0])
CONFIG.api_keys[normalized_model_name].append(CONFIG.api_keys[normalized_model_name].pop(0))
CONFIG.api_keys[normalized_model_name].append(
CONFIG.api_keys[normalized_model_name].pop(0))
return apiconfig
Loading