Создана первоначальная структура обращения к языковым моделям
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import asyncio
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# from pydantic import BaseModel
|
||||
from pydantic_ai import Agent
|
||||
|
||||
from llm.config import load_config
|
||||
from llm.factory import LLMModelProvider
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
async def main():
|
||||
|
||||
|
||||
config = load_config("config.yml")
|
||||
model = await LLMModelProvider.create_from_config(config.llm)
|
||||
|
||||
|
||||
# model = await LLMModelProvider.create_codex(model_name='gpt-5.6-luna')
|
||||
# model = LLMModelProvider.create_openai_compatible(model_name="qwen/qwen3-8b",
|
||||
# api_key=os.getenv("API_KEY"),
|
||||
# base_url=os.getenv("BASE_URL"))
|
||||
agent = Agent(model=model)
|
||||
result = await agent.run('Привет, дай мне ответ')
|
||||
print(result.output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user