richardblythman commited on
Commit
a805bcd
1 Parent(s): 85e9262

Upload folder using huggingface_hub

Browse files
README.md ADDED
File without changes
multiplayer_chat/__init__.py ADDED
File without changes
multiplayer_chat/component.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ author: richardblythman
2
+ description: multiplayer_chat
3
+ implementation:
4
+ package:
5
+ entrypoint: run.py
6
+ inputs:
7
+ location: node
8
+ save: false
9
+ system_message: You are a helpful AI assistant.
10
+ license: MIT
11
+ models:
12
+ default_model_provider: ollama
13
+ ollama:
14
+ api_base: http://localhost:11434
15
+ max_tokens: 1000
16
+ model: ollama/phi
17
+ temperature: 0
18
+ name: multiplayer_chat
19
+ outputs:
20
+ filename: output.txt
21
+ location: node
22
+ save: false
23
+ type: multiplayer_chat
24
+ version: 0.1.0
multiplayer_chat/run.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from naptha_sdk.utils import get_logger
2
+
3
+ logger = get_logger(__name__)
4
+
5
+ def run(inputs, worker_nodes = None, orchestrator_node = None, flow_run = None, cfg: dict = None):
6
+ from naptha_sdk.agent_service import AgentService
7
+ chat_initiator = AgentService(naptha, name="chat_initiator", fn=chat, worker_node_url="http://node.naptha.ai:7001")
8
+ chat_receiver = AgentService(naptha, name="chat_receiver", fn=chat, worker_node_url="http://node1.naptha.ai:7001")
9
+
10
+ response = await chat_initiator(inputs=inputs.prompt)
11
+ for i in range(10):
12
+ response = await chat_receiver(inputs=response)
13
+ response = await chat_initiator(inputs=response)
14
+ return response
multiplayer_chat/schemas.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from pydantic import BaseModel
2
+
3
+ class InputSchema(BaseModel):
4
+ prompt: str
pyproject.toml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "multiplayer-chat"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["Your Name <[email protected]>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.dependencies]
9
+ python = "^3.12"
10
+
11
+
12
+ [build-system]
13
+ requires = ["poetry-core"]
14
+ build-backend = "poetry.core.masonry.api"
tests/__init__.py ADDED
File without changes