Skip to content

Commit

Permalink
Merge pull request #258 from gumberss/feat/llm-client
Browse files Browse the repository at this point in the history
feat: adapter out
  • Loading branch information
gumberss authored Aug 6, 2024
2 parents 155cab5 + e5705cd commit 25bab1b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
Empty file.
5 changes: 5 additions & 0 deletions services/llm-client/adapters/outputs/interactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from wires.outputs.interactions import Interaction as WireOutInteraction
from models.interactions import InteractionRequest

def model_to_dto(interaction_request: InteractionRequest) -> WireOutInteraction:
return WireOutInteraction(request_id=interaction_request.id, response=interaction_request.response)
4 changes: 3 additions & 1 deletion services/llm-client/diplomat/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from adapters.inputs.interaction import dto_to_model
from components.component_manager import ComponentManager
from components.scylla_connection import ScyllaConnection
from adapters.outputs import interactions

app = FastAPI()

Expand All @@ -17,4 +18,5 @@ async def shutdown_event():

@app.post("/api/llm/interactions")
def greet(interaction: Interaction):
return new_interaction(dto_to_model(interaction), ComponentManager.get_component(ScyllaConnection))
return interactions.model_to_dto(new_interaction(dto_to_model(interaction), ComponentManager.get_component(ScyllaConnection)))

Binary file not shown.
Empty file.
8 changes: 8 additions & 0 deletions services/llm-client/wires/outputs/interactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from uuid import UUID

class Interaction():
def __init__(self, request_id: UUID, response:str):
self.requestId = request_id
self.response = response


0 comments on commit 25bab1b

Please sign in to comment.