From f4c40edbb68c4efbe3b9d69bbc13bba414d266e7 Mon Sep 17 00:00:00 2001 From: PeriniM Date: Wed, 7 Feb 2024 13:52:12 +0100 Subject: [PATCH] fix: params --- pydantic_class.py | 5 +++++ yosoai/class_generator.py | 3 +-- yosoai/pydantic_class.py | 2 +- yosoai/request.py | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 pydantic_class.py diff --git a/pydantic_class.py b/pydantic_class.py new file mode 100644 index 00000000..87f2c56d --- /dev/null +++ b/pydantic_class.py @@ -0,0 +1,5 @@ + +from langchain_core.pydantic_v1 import BaseModel, Field + +class _Response(BaseModel): + title: str = Field(description='Title of the news') diff --git a/yosoai/class_generator.py b/yosoai/class_generator.py index c3a7835a..31729b37 100644 --- a/yosoai/class_generator.py +++ b/yosoai/class_generator.py @@ -6,12 +6,11 @@ from langchain_core.pydantic_v1 import Field from langchain.output_parsers import PydanticOutputParser class Generator: - def __init__(self, values: list[dict], api_key: str, temperature_param: float = 0.0, model_name: str = "gpt-3.5-turbo") -> dict: + def __init__(self, api_key: str, temperature_param: float = 0.0, model_name: str = "gpt-3.5-turbo") -> dict: """ Initializes the Generator object. Args: - values (list): A list of values used for class creation. api_key (str): The API key for accessing the language model. temperature_param (float): A parameter controlling the randomness of the language model's output. model_name (str): The name of the language model to be used (default: "gpt-3.5-turbo"). All diff --git a/yosoai/pydantic_class.py b/yosoai/pydantic_class.py index 7af62077..b04a1658 100644 --- a/yosoai/pydantic_class.py +++ b/yosoai/pydantic_class.py @@ -1,4 +1,4 @@ from langchain_core.pydantic_v1 import BaseModel, Field class _Response(BaseModel): - title: str = Field(description='Title of the news') + title_news: str = Field(description='Give me the name of the news') diff --git a/yosoai/request.py b/yosoai/request.py index 537b3018..7333d405 100644 --- a/yosoai/request.py +++ b/yosoai/request.py @@ -1,8 +1,8 @@ import time from typing import List from .getter import remover -from .class_creator import create_class from .class_generator import Generator +from .class_creator import create_class from .token_calculator import truncate_text_tokens EMBEDDING_ENCODING = 'cl100k_base'