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
3.10.14 | packaged by Anaconda, Inc. | (main, May 6 2024, 19:44:50) [MSC v.1916 64 bit (AMD64)] win32
0.1.6.9
Problem description
AuthenticationError will be raised when creating an OpenAIEmbedding instance when utilize an OpenAI proxy service.
To be more specific, the key argument OPENAI_API_BASE_URL is not considered in openai_embedding.py.
Reproducible example code
The Python snippets:
fromcamel.embeddingsimportOpenAIEmbeddingopenai_api_key="your api key"openai_base_url="your base url"os.environ["OPENAI_API_KEY"] =openai_api_keyos.environ["OPENAI_API_BASE_URL"] =openai_base_urlembedding_model=OpenAIEmbedding()
text="camel"vector=embedding_model.embed(text)
Command lines:
(camel) PS C:\Users\YUI\.cursor-tutor\projects> python .\main.py
Traceback (most recent call last):
File "C:\Users\YUI\.cursor-tutor\projects\main.py", line 11, in<module>
vector = embedding_model.embed(text)
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\camel\embeddings\base.py", line 58, in embed
return self.embed_list([obj], **kwargs)[0]
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\camel\utils\commons.py", line 269, in wrapper
return func(self, *args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\camel\embeddings\openai_embedding.py", line 78, in embed_list
response = self.client.embeddings.create(
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\openai\resources\embeddings.py", line 114, in create
return self._post(
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\openai\_base_client.py", line 1260, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\openai\_base_client.py", line 937, in request
return self._request(
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\openai\_base_client.py", line 1041, in _request
raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-XA0vI***************************************6fF9. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Steps to reproduce:
set OPENAI_API_KEY and OPENAI_API_BASE_URL
create an instance of OpenAIEmbedding
call its embed method
Traceback
Traceback (most recent call last):
File "C:\Users\YUI\.cursor-tutor\projects\main.py", line 11, in <module>
vector = embedding_model.embed(text)
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\camel\embeddings\base.py", line 58, in embedreturnself.embed_list([obj], **kwargs)[0]
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\camel\utils\commons.py", line 269, in wrapperreturn func(self, *args, **kwargs)
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\camel\embeddings\openai_embedding.py", line 78, in embed_list
response =self.client.embeddings.create(
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\openai\resources\embeddings.py", line 114, in createreturnself._post(
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\openai\_base_client.py", line 1260, in postreturn cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\openai\_base_client.py", line 937, in requestreturnself._request(
File "C:\ProgramData\Anaconda3\envs\camel\lib\site-packages\openai\_base_client.py", line 1041, in _requestraiseself._make_status_error_from_response(err.response) fromNoneopenai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-XA0vI***************************************6fF9. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Expected behavior
If I set os.environ["OPENAI_API_BASE_URL"] in the environment variables, then after instantiating OpenAIEmbedding(), it can be used directly. Alternatively, a new optional url parameter can be added, allowing the user to manually specify it when instantiating the embedding model, such as OpenAIEmbedding(url="your base url").
Additional context
No response
The text was updated successfully, but these errors were encountered:
Required prerequisites
What version of camel are you using?
0.1.6.9
System information
3.10.14 | packaged by Anaconda, Inc. | (main, May 6 2024, 19:44:50) [MSC v.1916 64 bit (AMD64)] win32
0.1.6.9
Problem description
AuthenticationError will be raised when creating an OpenAIEmbedding instance when utilize an OpenAI proxy service.
To be more specific, the key argument OPENAI_API_BASE_URL is not considered in
openai_embedding.py
.Reproducible example code
The Python snippets:
Command lines:
Steps to reproduce:
OPENAI_API_KEY
andOPENAI_API_BASE_URL
OpenAIEmbedding
embed
methodTraceback
Expected behavior
If I set
os.environ["OPENAI_API_BASE_URL"]
in the environment variables, then after instantiatingOpenAIEmbedding()
, it can be used directly. Alternatively, a new optionalurl
parameter can be added, allowing the user to manually specify it when instantiating the embedding model, such asOpenAIEmbedding(url="your base url")
.Additional context
No response
The text was updated successfully, but these errors were encountered: