diff --git a/.env b/.env index cae8618bd..a5cabaa7d 100644 --- a/.env +++ b/.env @@ -1,2 +1,22 @@ +OPENAI_API_TYPE=placeholder +# if OPENAI_API_TYPE is "azure", then the OPENAI_API_KEY is the Azure API key OPENAI_API_KEY=placeholder + +AZURE_OPENAI_API_BASE=placeholder +AZURE_OPENAI_API_VERSION=placeholder +AZURE_OPENAI_API_KEY=placeholder +AZURE_OPENAI_DEPLOYMENT_NAME=placeholder +AZURE_OPENAI_DEPLOYMENT_NAME_EB="your_azure_embedding_deployment_name_here" + +REDIS_URL=placeholder + ANTHROPIC_API_KEY=placeholder +YDC_API_KEY=your_secret_here +LANGCHAIN_TRACING_V2="true" +LANGCHAIN_PROJECT=langserve-launch-example +LANGCHAIN_API_KEY=your_secret_key_here +TAVILY_API_KEY=your_secret_here +FIREWORKS_API_KEY=your_secret_here +AWS_ACCESS_KEY_ID=your_secret_here +AWS_SECRET_ACCESS_KEY=your_secret_here +KAY_API_KEY=your_secret_here \ No newline at end of file diff --git a/backend/packages/gizmo-agent/gizmo_agent/ingest.py b/backend/packages/gizmo-agent/gizmo_agent/ingest.py index e1e41c01a..294a1b0ab 100644 --- a/backend/packages/gizmo-agent/gizmo_agent/ingest.py +++ b/backend/packages/gizmo-agent/gizmo_agent/ingest.py @@ -9,16 +9,28 @@ index_schema = { "tag": [{"name": "namespace"}], } + +if os.environ["OPENAI_API_TYPE"] == "azure": + embeddings = OpenAIEmbeddings( + deployment=os.environ["AZURE_OPENAI_DEPLOYMENT_NAME_EB"], + model=os.environ["AZURE_OPENAI_DEPLOYMENT_NAME_EB"], + openai_api_base=os.environ["AZURE_OPENAI_API_BASE"], + openai_api_type="azure", + ) +else: + embeddings = OpenAIEmbeddings() + vstore = Redis( redis_url=os.environ["REDIS_URL"], index_name="opengpts", - embedding=OpenAIEmbeddings(), + embedding=embeddings, index_schema=index_schema, ) ingest_runnable = IngestRunnable( - text_splitter=RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200), + text_splitter=RecursiveCharacterTextSplitter( + chunk_size=1000, chunk_overlap=200), vectorstore=vstore, ).configurable_fields( assistant_id=ConfigurableField(