Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -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
16 changes: 14 additions & 2 deletions backend/packages/gizmo-agent/gizmo_agent/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down