from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider
## Connect PydanticAI to LLMs on Neosantara
model = OpenAIChatModel(
'nusantara-base',
provider=OpenAIProvider(
base_url="https://api.neosantara.xyz/v1",
api_key=os.environ.get("NAI_API_KEY"),
),
)
## Setup the agent
agent = Agent(
model,
system_prompt='Be concise, reply with one sentence.',
)
result = agent.run_sync('Where does "hello world" come from?')
print(result.output)