Skip to content

Commit

Permalink
Patryk nie patrz
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJimmyNowak committed Oct 27, 2024
1 parent 83040db commit 9af2a48
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 25 deletions.
4 changes: 2 additions & 2 deletions api/bot/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def query_llm_controller(payload: BotIn) -> tuple[HTTPStatus, BotOut]:
embeddings_body = {
"input": payload.input
}
response = requests.post("http://192.168.0.3:9000/v1/embeddings/", json=embeddings_body)
response = requests.post("http://llm-embedding-cpu:9000/v1/embeddings/", json=embeddings_body)
input_embedding = response.json()['data'][0]['embedding']
similar_chunks = Chunk.objects.order_by(L2Distance('embedding', input_embedding).desc())[:5]
similar_chunks_text = "".join([chunk.text for chunk in similar_chunks])
print(similar_chunks_text)
model_url = "http://192.168.0.3:9000/v1/"
model_url = "http://llm-embedding-cpu:9000/v1/"
llm = OpenAI(temperature=0.5,
openai_api_key="XD",
openai_api_base=model_url
Expand Down
2 changes: 1 addition & 1 deletion discord_bot/discord_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def sync(ctx) -> None:

def query_llm(prompt):
"""Returns llm's response."""
url = "http://192.168.0.1:8000/api/bot/"
url = "http://api:8000/api/bot/"
headers = {"Content-Type": "application/json"}
data = {"input": prompt}

Expand Down
23 changes: 2 additions & 21 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ services:

db:
profiles: [ "dev", "prod" ]
build:
context: ./postgres
dockerfile: postgres.Dockerfile
image: pgvector/pgvector:0.7.4-pg17
volumes:
- ./db:/var/lib/postgresql/data
- ./postgres/vector_extension.sql:/docker-entrypoint-initdb.d/0-vector_extension.sql
env_file:
- .env
networks:
inner:
ipv4_address: 192.168.0.4

api:
profiles: [ "dev", "prod" ]
build:
Expand All @@ -29,9 +25,6 @@ services:
- "8000:8000"
depends_on:
- db
networks:
inner:
ipv4_address: 192.168.0.2

llm-embedding-cpu:
profiles: [ "cpu" ]
Expand All @@ -41,9 +34,6 @@ services:
- ./llm/models:/models
ports:
- "9000:9000"
networks:
inner:
ipv4_address: 192.168.0.3

llm-embedding-gpu:
profiles: [ "gpu" ]
Expand All @@ -60,13 +50,4 @@ services:
- driver: nvidia
count: 1
capabilities: [ gpu ]
networks:
inner:
ipv4_address: 192.168.0.3

networks:
inner:
ipam:
driver: default
config:
- subnet: 192.168.0.0/30
Empty file modified llm/Dockerfile
100644 → 100755
Empty file.
Empty file modified llm/poetry.lock
100644 → 100755
Empty file.
Empty file modified llm/pyproject.toml
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion postgres/postgres.Dockerfile → postgres/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ RUN git clone https://github.com/pgvector/pgvector.git

WORKDIR /tmp/pgvector
RUN make
RUN make install
RUN make install

0 comments on commit 9af2a48

Please sign in to comment.