PhysNOR class

A small adapter that talks to a Gemini-style generative model and presents a PhysNOR helper to fetch physics answers.

Constructors

PhysNOR({required String apiKey, String? model, String? systemPrompt})

Properties

apiKey String
final
conversation List<Map<String, String>>
Optional in-memory conversation useful for chat apps. Each message is a map with keys: 'author' and 'content'. Use addUserMessage / addAssistantMessage to manage it.
final
hashCode int
The hash code for this object.
no setterinherited
model String
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
systemPrompt String
final

Methods

addAssistantMessage(String content) → void
Add an assistant message to the in-memory conversation.
addUserMessage(String content) → void
Add a user message to the in-memory conversation.
ask(String question, {double temperature = 0.2}) Future<String>
Ask the physics specialist a question and return the raw text response.
buildChatPayload(List<Map<String, String>> messages, double temperature) Map<String, dynamic>
Build a chat-style payload from a list of messages (maps with 'author'/'content'). Ensures the system prompt is the first message.
buildRequestPayload(String question, double temperature) Map<String, dynamic>
Build the JSON payload sent to the AI endpoint.
chatAsk(List<Map<String, String>> messages, {double temperature = 0.2}) Future<String>
Send a chat-style list of messages to the model and return the text.
clearConversation() → void
Clear the in-memory conversation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setModel(String newModel) → void
Change the target model (e.g. 'models/gemini' or 'myOrg/myModel').
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited