Skip to content

Commit

Permalink
Add inline_context check in LangChain
Browse files Browse the repository at this point in the history
  • Loading branch information
codingbandit committed Aug 1, 2024
1 parent 5aa5ffe commit 70fa202
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def _get_document_retriever(
Get the vector document retriever, if it exists.
"""
retriever = None

if agent.vectorization is not None and not agent.inline_context:
text_embedding_profile = AzureOpenAIEmbeddingProfile.from_object(
request.objects[agent.vectorization.text_embedding_profile_object_id]
Expand Down Expand Up @@ -241,7 +242,8 @@ def _validate_request(self, request: KnowledgeManagementCompletionRequest):
self.prompt = self._get_prompt_from_object_id(request.agent.prompt_object_id, request.objects)
if self.prompt.prefix is None or self.prompt.prefix == '':
raise LangChainException("The Prompt object provided in the request's objects dictionary is invalid because it is missing a prefix value.", 400)
if request.agent.vectorization is not None:

if request.agent.vectorization is not None and not request.agent.inline_context:
if request.agent.vectorization.text_embedding_profile_object_id is None or request.agent.vectorization.text_embedding_profile_object_id == '':
raise LangChainException("The TextEmbeddingProfileObjectId property of the agent's Vectorization property cannot be null or empty.", 400)

Expand Down

0 comments on commit 70fa202

Please sign in to comment.