AuthenticationError Traceback (most recent call last) Cell In[13], line 12 9 return hashlib.sha1(json.dumps(doc.metadata, sort_keys=True).encode()).hexdigest() 11 split_ids = list(map(stable_hash, splits)) ---> 12 docs_vectorstore.add_documents(splits, ids=split_ids) 13 docs_vectorstore.persist() File /opt/anaconda3/lib/python3.11/site-packages/langchain_core/vectorstores.py:138, in VectorStore.add_documents(self, documents, **kwargs) 136 texts = [doc.page_content for doc in documents] 137 metadatas = [doc.metadata for doc in documents] --> 138 return self.add_texts(texts, metadatas, **kwargs) File /opt/anaconda3/lib/python3.11/site-packages/langchain_community/vectorstores/chroma.py:276, in Chroma.add_texts(self, texts, metadatas, ids, **kwargs) 274 texts = list(texts) 275 if self._embedding_function is not None: --> 276 embeddings = self._embedding_function.embed_documents(texts) 277 if metadatas: 278 # fill metadatas with empty dicts if somebody 279 # did not specify metadata for all texts 280 length_diff = len(texts) - len(metadatas) File /opt/anaconda3/lib/python3.11/site-packages/langchain_openai/embeddings/base.py:489, in OpenAIEmbeddings.embed_documents(self, texts, chunk_size) 486 # NOTE: to keep things simple, we assume the list may contain texts longer 487 # than the maximum context and use length-safe embedding function. 488 engine = cast(str, self.deployment) --> 489 return self._get_len_safe_embeddings(texts, engine=engine) File /opt/anaconda3/lib/python3.11/site-packages/langchain_openai/embeddings/base.py:347, in OpenAIEmbeddings._get_len_safe_embeddings(self, texts, engine, chunk_size) 345 batched_embeddings: List[List[float]] = [] 346 for i in _iter: --> 347 response = self.client.create( 348 input=tokens[i : i + _chunk_size], **self._invocation_params 349 ) 350 if not isinstance(response, dict): 351 response = response.model_dump() File /opt/anaconda3/lib/python3.11/site-packages/openai/resources/embeddings.py:114, in Embeddings.create(self, input, model, dimensions, encoding_format, user, extra_headers, extra_query, extra_body, timeout) 108 embedding.embedding = np.frombuffer( # type: ignore[no-untyped-call] 109 base64.b64decode(data), dtype="float32" 110 ).tolist() 112 return obj --> 114 return self._post( 115 "/embeddings", 116 body=maybe_transform(params, embedding_create_params.EmbeddingCreateParams), 117 options=make_request_options( 118 extra_headers=extra_headers, 119 extra_query=extra_query, 120 extra_body=extra_body, 121 timeout=timeout, 122 post_parser=parser, 123 ), 124 cast_to=CreateEmbeddingResponse, 125 ) File /opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py:1240, in SyncAPIClient.post(self, path, cast_to, body, options, files, stream, stream_cls) 1226 def post( 1227 self, 1228 path: str, (...) 1235 stream_cls: type[_StreamT] | None = None, 1236 ) -> ResponseT | _StreamT: 1237 opts = FinalRequestOptions.construct( 1238 method="post", url=path, json_data=body, files=to_httpx_files(files), **options 1239 ) -> 1240 return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File /opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py:921, in SyncAPIClient.request(self, cast_to, options, remaining_retries, stream, stream_cls) 912 def request( 913 self, 914 cast_to: Type[ResponseT], (...) 919 stream_cls: type[_StreamT] | None = None, 920 ) -> ResponseT | _StreamT: --> 921 return self._request( 922 cast_to=cast_to, 923 options=options, 924 stream=stream, 925 stream_cls=stream_cls, 926 remaining_retries=remaining_retries, 927 ) File /opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py:1020, in SyncAPIClient._request(self, cast_to, options, remaining_retries, stream, stream_cls) 1017 err.response.read() 1019 log.debug("Re-raising status error") -> 1020 raise self._make_status_error_from_response(err.response) from None 1022 return self._process_response( 1023 cast_to=cast_to, 1024 options=options, (...) 1027 stream_cls=stream_cls, 1028 ) AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: "sk-XCPv*****************************************kMd". You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}