diff --git a/src/backend/langflow/components/embeddings/AzureOpenAIEmbeddings.py b/src/backend/langflow/components/embeddings/AzureOpenAIEmbeddings.py index 5e1238029..e4fdd8738 100644 --- a/src/backend/langflow/components/embeddings/AzureOpenAIEmbeddings.py +++ b/src/backend/langflow/components/embeddings/AzureOpenAIEmbeddings.py @@ -2,19 +2,20 @@ from langflow import CustomComponent from langchain.embeddings.base import Embeddings from langchain_community.embeddings import AzureOpenAIEmbeddings + class AzureOpenAIEmbeddingsComponent(CustomComponent): display_name: str = "AzureOpenAIEmbeddings" description: str = "Embeddings model from Azure OpenAI." documentation: str = "https://python.langchain.com/docs/integrations/text_embedding/azureopenai" beta = False - + API_VERSION_OPTIONS = [ "2022-12-01", "2023-03-15-preview", "2023-05-15", "2023-06-01-preview", "2023-07-01-preview", - "2023-08-01-preview" + "2023-08-01-preview", ] def build_config(self): @@ -39,10 +40,9 @@ class AzureOpenAIEmbeddingsComponent(CustomComponent): "required": True, "password": True, }, - "code": { - "show": False - }, + "code": {"show": False}, } + def build( self, azure_endpoint: str, @@ -52,13 +52,13 @@ class AzureOpenAIEmbeddingsComponent(CustomComponent): ) -> Embeddings: try: embeddings = AzureOpenAIEmbeddings( - azure_endpoint = azure_endpoint, - deployment = azure_deployment, - openai_api_version = api_version, - openai_api_key = api_key, + azure_endpoint=azure_endpoint, + deployment=azure_deployment, + openai_api_version=api_version, + openai_api_key=api_key, ) except Exception as e: raise ValueError("Could not connect to AzureOpenAIEmbeddings API.") from e - + return embeddings diff --git a/src/backend/langflow/components/embeddings/OllamaEmbeddings.py b/src/backend/langflow/components/embeddings/OllamaEmbeddings.py index 388afe3f6..65c6aca3b 100644 --- a/src/backend/langflow/components/embeddings/OllamaEmbeddings.py +++ b/src/backend/langflow/components/embeddings/OllamaEmbeddings.py @@ -4,6 +4,7 @@ from langflow import CustomComponent from langchain.embeddings.base import Embeddings from langchain_community.embeddings import OllamaEmbeddings + class OllamaEmbeddingsComponent(CustomComponent): """ A custom component for implementing an Embeddings Model using Ollama. @@ -23,7 +24,7 @@ class OllamaEmbeddingsComponent(CustomComponent): "temperature": {"display_name": "Model Temperature"}, "code": {"show": False}, } - + def build( self, model: str = "llama2", @@ -31,11 +32,7 @@ class OllamaEmbeddingsComponent(CustomComponent): temperature: Optional[float] = None, ) -> Embeddings: try: - output = OllamaEmbeddings( - model=model, - base_url=base_url, - temperature=temperature - ) # type: ignore + output = OllamaEmbeddings(model=model, base_url=base_url, temperature=temperature) # type: ignore except Exception as e: raise ValueError("Could not connect to Ollama API.") from e - return output \ No newline at end of file + return output diff --git a/src/backend/langflow/components/llms/AzureChatOpenAI.py b/src/backend/langflow/components/llms/AzureChatOpenAI.py index 4595e3322..3a99636ff 100644 --- a/src/backend/langflow/components/llms/AzureChatOpenAI.py +++ b/src/backend/langflow/components/llms/AzureChatOpenAI.py @@ -25,7 +25,7 @@ class AzureChatOpenAIComponent(CustomComponent): "2023-06-01-preview", "2023-07-01-preview", "2023-08-01-preview", - "2023-12-01-preview" + "2023-12-01-preview", ] def build_config(self): @@ -52,11 +52,7 @@ class AzureChatOpenAIComponent(CustomComponent): "required": True, "advanced": True, }, - "api_key": { - "display_name": "API Key", - "required": True, - "password": True - }, + "api_key": {"display_name": "API Key", "required": True, "password": True}, "temperature": { "display_name": "Temperature", "value": 0.7, @@ -71,10 +67,9 @@ class AzureChatOpenAIComponent(CustomComponent): "advanced": True, "info": "Maximum number of tokens to generate.", }, - "code": { - "show": False - }, + "code": {"show": False}, } + def build( self, model: str, diff --git a/src/backend/langflow/interface/chains/custom.py b/src/backend/langflow/interface/chains/custom.py index 01aad73c3..27ed646b2 100644 --- a/src/backend/langflow/interface/chains/custom.py +++ b/src/backend/langflow/interface/chains/custom.py @@ -67,7 +67,9 @@ Human: {input} class MidJourneyPromptChain(BaseCustomConversationChain): """MidJourneyPromptChain is a chain you can use to generate new MidJourney prompts.""" - template: Optional[str] = """I want you to act as a prompt generator for Midjourney's artificial intelligence program. + template: Optional[ + str + ] = """I want you to act as a prompt generator for Midjourney's artificial intelligence program. Your job is to provide detailed and creative descriptions that will inspire unique and interesting images from the AI. Keep in mind that the AI is capable of understanding a wide range of language and can interpret abstract concepts, so feel free to be as imaginative and descriptive as possible. For example, you could describe a scene from a futuristic city, or a surreal landscape filled with strange creatures. @@ -81,7 +83,9 @@ class MidJourneyPromptChain(BaseCustomConversationChain): class TimeTravelGuideChain(BaseCustomConversationChain): - template: Optional[str] = """I want you to act as my time travel guide. You are helpful and creative. I will provide you with the historical period or future time I want to visit and you will suggest the best events, sights, or people to experience. Provide the suggestions and any necessary information. + template: Optional[ + str + ] = """I want you to act as my time travel guide. You are helpful and creative. I will provide you with the historical period or future time I want to visit and you will suggest the best events, sights, or people to experience. Provide the suggestions and any necessary information. Current conversation: {history} Human: {input} diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index eee83a29c..cbe978933 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -5,7 +5,6 @@ import BuildTrigger from "./buildTrigger"; import ChatTrigger from "./chatTrigger"; import * as _ from "lodash"; -import { getBuildStatus } from "../../controllers/API"; import FormModal from "../../modals/formModal"; import useFlowStore from "../../stores/flowStore"; import { NodeType } from "../../types/flow";