Skip to content

Commit

Permalink
Merge pull request #78 from datakind/bugfix/pgvector-assistant
Browse files Browse the repository at this point in the history
Bugfix/pgvector assistant
  • Loading branch information
kilroyzhere authored Dec 6, 2024
2 parents 6a82f22 + d87c800 commit 4da88dc
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ jobs:
# TODO this should be enhanced to use a buildx bake to leverage layer caching for faster builds, or push to repo and simply have a pull for the run
# TODO docker-compose files should be refactored to use scopes instead of different versions for each environment
echo "Starting docker containers for dbs and server ..."
docker-compose pull
docker-compose up -d --build datadb recipedb server chat
docker compose pull
docker compose up -d --build datadb recipedb server chat
# TODO: For some reason, maybe buildkit, in Github docker compose builds the image differently, and it doesn't work. Individual image build works.
docker build --build-arg OPENAI_API_KEY=$ASSISTANTS_API_KEY \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/get_memory_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
ls data/datadb
echo "Starting docker containers for dbs and server ..."
docker-compose pull
docker-compose up -d --build datadb recipedb server datadb
docker compose pull
docker compose up -d --build datadb recipedb server datadb
sleep 10
Expand Down
14 changes: 10 additions & 4 deletions deployment/deploy_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import docker
from dotenv import load_dotenv

# client = docker.from_env()
load_dotenv()

container_registry = os.getenv("AZURE_CONTAINER_REGISTRY")
Expand All @@ -25,8 +26,11 @@

if sys.platform == "darwin":
print("Running on Mac")
print(f"container_registry: {container_registry}")
print(f"repo: {repo}")
client = docker.DockerClient(
base_url="unix:///Users/matthewharris/.docker/run/docker.sock "
# base_url="unix:///Users/matthewharris/.docker/run/docker.sock "
base_url="unix:///Users/t.o./.docker/run/docker.sock "
)
else:
client = docker.from_env()
Expand Down Expand Up @@ -72,8 +76,8 @@ def deploy():
sys.exit()

tags = {
"data-recipes-ai-server": [f"{container_registry}/{repo}", "server"],
"data-recipes-ai-chat": [f"{container_registry}/{repo}", "chat"],
"data-recipes-ai-server:latest": [f"{container_registry}/{repo}", "server"],
"data-recipes-ai-chat:latest": [f"{container_registry}/{repo}", "chat"],
}

run_cmd("az login")
Expand All @@ -87,13 +91,15 @@ def deploy():
f"DOCKER_DEFAULT_PLATFORM={azure_platform} && docker compose -f {docker_compose_file} build"
)

# run_cmd("docker compose build")

for image in tags.keys():
print(f"Tagging {image} image ... with tag {tags[image][0]}:{tags[image][1]}")
client.images.get(image).tag(tags[image][0], tags[image][1])
print(f"Pushing {image} image ... to {tags[image][0]}:{tags[image][1]}")
client.images.push(tags[image][0], tags[image][1])

sys.exit()
# sys.exit()

run_cmd(f"docker compose -f {docker_compose_file} down")
run_cmd(f"docker compose -f {docker_compose_file} pull")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ langchain_openai==0.1.7
literalai==0.0.604
matplotlib==3.9.0
pandas==2.2.2
pgvector==0.2.4
pgvector==0.2.5
plotly==5.22.0
psycopg2_binary==2.9.9
pyarrow==16.1.0
Expand Down
4 changes: 2 additions & 2 deletions server/robocorp/actions_plugins/recipe-server/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ dependencies:
- robocorp-actions=0.0.7
- langchain=0.1.16
- langchain_community=0.0.34
- langchain_openai=0.1.3
- psycopg2-binary=2.9.3
- langchain_openai=0.1.3
- pgvector=0.2.5
- python-dotenv=0.19.1
- pillow=10.3.0
Expand All @@ -32,3 +31,4 @@ dependencies:
- seaborn=0.13.2
- geopandas=0.10.2
- hdx_python_api=6.2.4
- psycopg2-binary=2.9.3
2 changes: 1 addition & 1 deletion server/robocorp/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ dependencies:
- langchain=0.1.16
- langchain_community=0.0.34
- langchain_openai=0.1.3
- psycopg2-binary=2.9.3
- pgvector=0.2.5
- psycopg2-binary=2.9.3

1 change: 1 addition & 0 deletions utils/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def initialize_vector_db():
collection_name=COLLECTION_NAME,
connection_string=CONNECTION_STRING,
embedding_function=embedding_model,
create_extension=False,
)

return db
Expand Down

0 comments on commit 4da88dc

Please sign in to comment.