Python serves as the implementation layer for AI-augmented financial research: it sends prompts to public LLM APIs, stores returned answers in variables, and supports further processing. The same workflow can run through Jupyter Notebooks or use locally downloaded open-source models. section 8.3.2
Practical Python workflows include:
- Calling OpenAI, Gemini, Anthropic, or Mistral models through provider-specific Python clients. section 8.3.2
- Controlling model behavior with system prompts, temperature, maximum output tokens, and model selection. section 8.3.2
- Loading Hugging Face models and tokenizers for local prompt execution. section 8.3.2
- Extending prompt workflows toward structured repositories, Notion exports, n8n, and Python-coded LangChain agents. section 9.0
Listing 8.8 Submit a prompt via the OpenAI API
from openai import OpenAI
client = OpenAI(
api_key=api_key
)
completion = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": system_content},
{"role": "user", "content": question}
]
)
A compact OpenAI example shows how Python creates a client, submits system and user messages, selects a model, and retrieves a completion. section 8.3.2

























