some changes
This commit is contained in:
1 parent
cccdb7d231
commit
a3700ca15a
7 files changed
+36
-12
No files matched your search
@@ -5,6 +5,11 @@ from sqlalchemy.sql.expression import select
|
||||
from tortoise import fields, models, Tortoise
|
||||
import asyncio
|
||||
|
||||
# These types don't represent all objects in Horde.
|
||||
# Agents and Chats can be created for just a session, in which case, they
|
||||
# are not saved on the database, as aren't all their associated values of
|
||||
# other classes.
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import threading
|
||||
import ollama
|
||||
from stream import Stream
|
||||
|
||||
|
||||
@@ -18,13 +19,15 @@ class Models:
|
||||
qwen3_8b = "lucataco/qwen3-vl-8b-instruct:39e893666996acf464cff75688ad49ac95ef54e9f1c688fbc677330acc478e11"
|
||||
qwen3_235b = "qwen/qwen3-235b-a22b-instruct-2507"
|
||||
|
||||
async def ollama_chat_completion(app, messages, model, opts={}):
|
||||
from ollama import AsyncClient
|
||||
async def ollama_list(app, messages, model, opts={}):
|
||||
# TODO: test the output, and use this
|
||||
return ollama.list()
|
||||
|
||||
async def ollama_chat_completion(app, messages, model, opts={}):
|
||||
content_stream = Stream(app)
|
||||
|
||||
print("START OLLAMA INFERENCE")
|
||||
stream_response = await AsyncClient().chat(
|
||||
stream_response = await ollama.AsyncClient().chat(
|
||||
model=model,
|
||||
messages=[{'role': msg.role, 'content': msg.content} for msg in messages],
|
||||
stream=True,
|
||||
|
||||
@@ -133,6 +133,12 @@ def start_server(app):
|
||||
body = req.get('body', {})
|
||||
nonce = req.get('nonce', None)
|
||||
|
||||
def get_agent_id ():
|
||||
raise Exception("Cannot get agent id")
|
||||
|
||||
def get_chat_id ():
|
||||
raise Exception("Cannot get chat id")
|
||||
|
||||
if action == "ping":
|
||||
await send({'message': "pong"})
|
||||
|
||||
|
||||
Reference in new issue
Block a user