Begin work on agent core
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from threading import Thread
|
||||
from typing import Iterator
|
||||
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline, TextIteratorStreamer
|
||||
import torch
|
||||
@@ -44,7 +45,7 @@ class LlmEngine:
|
||||
return_full_text=False,
|
||||
)
|
||||
|
||||
def infer(self, system_prompt: str, main_context: str) -> TextIteratorStreamer:
|
||||
def infer(self, system_prompt: str, main_context: str) -> Iterator[str]:
|
||||
"""
|
||||
Run inference using the system prompt and main context, while validating actions against the provided XML schema.
|
||||
|
||||
@@ -53,7 +54,7 @@ class LlmEngine:
|
||||
main_context: The main context string after templating
|
||||
|
||||
Returns:
|
||||
TextIteratorStreamer: An iterator that yields the generated text.
|
||||
Iterator[str]: An iterator that yields the generated text.
|
||||
"""
|
||||
messages = [
|
||||
{"role": "system", "content": system_prompt},
|
||||
|
||||
Reference in New Issue
Block a user