diff --git a/codelinker/linker.py b/codelinker/linker.py index bbd89bd..8e504a9 100644 --- a/codelinker/linker.py +++ b/codelinker/linker.py @@ -2,12 +2,13 @@ import inspect import asyncio -from typing import Callable, Any, TypeVar +from typing import Callable, Any, TypeVar, Optional from functools import wraps from concurrent.futures import ThreadPoolExecutor from pydantic import TypeAdapter,BaseModel from copy import deepcopy + from .config import CodeLinkerConfig from .request import OBJGenerator from .models import SmartFuncLabel, StructureSchema, StructuredRet @@ -38,9 +39,9 @@ def replace_refs(schema, ret_schema): async def request( - prompt: str, return_type: TypeAdapter, objGen: OBJGenerator, + prompt: Optional[str] = None, request_name: str = "request", completions_kwargs: dict = {}, images: list = None, @@ -52,7 +53,8 @@ async def request( schema = return_type.json_schema() schema = replace_refs(schema, schema) messages = deepcopy(messages) - messages.append({"role": "user", "content": prompt}) + if prompt is not None: + messages.append({"role": "user", "content": prompt}) if images is not None and len(images) > 0: messages[-1]["content"] = [ @@ -158,8 +160,8 @@ def close(self): async def exec( self, - prompt: str, return_type: T, + prompt: Optional[str] = None, request_name: str = "request", completions_kwargs: dict = {}, images: list = None, diff --git a/pyproject.toml b/pyproject.toml index d6fe489..0a63ac1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "codelinker" -version = "0.2.5" +version = "0.2.6" description = "" authors = ["luyaxi "] readme = "README.md"