You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(env) ➜ GPTCacheAPI npc gptcache_server -s 0.0.0.0 -p 8009 -f config.yaml
start to install package: ruamel-yaml
[notice] A new release of pip available: 22.2.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
successfully installed package: ruamel-yaml
Traceback (most recent call last):
File "/data/python/ethan/app/GPTCacheAPI/env/bin/gptcache_server", line 8, in <module>
sys.exit(main())
File "/data/python/ethan/app/GPTCacheAPI/env/lib/python3.10/site-packages/gptcache_server/server.py", line 178, in main
init_conf = init_similar_cache_from_config(config_dir=args.cache_config_file)
File "/data/python/ethan/app/GPTCacheAPI/env/lib/python3.10/site-packages/gptcache/adapter/api.py", line 221, in init_similar_cache_from_config
data_manager = manager_factory(**storage_config)
File "/data/python/ethan/app/GPTCacheAPI/env/lib/python3.10/site-packages/gptcache/manager/factory.py", line 98, in manager_factory
v = VectorBase(name=vector, **vector_params)
File "/data/python/ethan/app/GPTCacheAPI/env/lib/python3.10/site-packages/gptcache/manager/vector_data/__init__.py", line 13, in VectorBase
return vector_manager.VectorBase.get(name, **kwargs)
File "/data/python/ethan/app/GPTCacheAPI/env/lib/python3.10/site-packages/gptcache/manager/vector_data/manager.py", line 157, in get
vector_base = Chromadb(
File "/data/python/ethan/app/GPTCacheAPI/env/lib/python3.10/site-packages/gptcache/manager/vector_data/chroma.py", line 45, in __init__
self._client = chromadb.Client(self._client_settings)
File "/data/python/ethan/app/GPTCacheAPI/env/lib/python3.10/site-packages/chromadb/__init__.py", line 30, in Client
telemetry_client = system.instance(Telemetry)
File "/data/python/ethan/app/GPTCacheAPI/env/lib/python3.10/site-packages/chromadb/config.py", line 156, in instance
fqn = self.settings.require(key)
AttributeError: 'dict' object has no attribute 'require'
Expected Behavior
(env) ➜ GPTCacheAPI npc gptcache_server -s 0.0.0.0 -p 8009 -f config.yaml
start to install package: ruamel-yaml
[notice] A new release of pip available: 22.2.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
successfully installed package: ruamel-yaml
INFO: Started server process [39587]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8009 (Press CTRL+C to quit)
Steps To Reproduce
No response
Environment
No response
Anything else?
embedding:
huggingfaceembedding_config:
# Set embedding model params heremodel: BAAI/bge-large-zh-v1.5storage_config:
data_dir:
gptcache_datamanager:
mariadb,chromadbscalar_params:
sql_url: mariadb+pymysql://usr:password@host:port/namevector_params:
dimension: 1024client_settings:
chroma_server_host: 10.67.74.xxxchroma_server_http_port: 8000anonymized_telemetry: Falseevaluation:
distanceevaluation_config:
# Set evaluation metric kws heremax_distance: 4.0positive: Falsepre_function:
get_promptpost_function:
firstconfig:
similarity_threshold: 0.8# Set other config here
Here is the chatGPT answer
It looks like there is an issue with the system.instance(Telemetry) call in your code. The error message indicates that the settings object passed to the instance method is a dictionary ('dict' object has no attribute 'require'). This suggests that the settings object is not an instance of the Settings class as expected.
In your YAML file, the vector_params section includes client_settings, which seems to be a dictionary. It appears that this dictionary is being passed as settings to the Client function, causing the error.
To resolve this issue, you should construct an instance of the Settings class using the values from your YAML file before passing it to the Client function. Here's an example of how you can modify your code:
importyamlfrompydanticimportBaseSettingsfromtypingimportOptional, List, Any, Literal# Your existing Settings class definitiondefload_settings_from_yaml(yaml_path: str) ->Settings:
withopen(yaml_path, 'r') asfile:
config_data=yaml.safe_load(file)
returnSettings(**config_data)
# Usage in your main codeyaml_file_path="path/to/your/config.yaml"settings=load_settings_from_yaml(yaml_file_path)
api_instance=Client(settings)
The text was updated successfully, but these errors were encountered:
Current Behavior
Expected Behavior
Steps To Reproduce
No response
Environment
No response
Anything else?
Here is the chatGPT answer
It looks like there is an issue with the system.instance(Telemetry) call in your code. The error message indicates that the settings object passed to the instance method is a dictionary ('dict' object has no attribute 'require'). This suggests that the settings object is not an instance of the Settings class as expected.
In your YAML file, the vector_params section includes client_settings, which seems to be a dictionary. It appears that this dictionary is being passed as settings to the Client function, causing the error.
To resolve this issue, you should construct an instance of the Settings class using the values from your YAML file before passing it to the Client function. Here's an example of how you can modify your code:
The text was updated successfully, but these errors were encountered: