Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update _types.py to support granite3.2 roles #465

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

atorsvn
Copy link

@atorsvn atorsvn commented Mar 13, 2025

@atorsvn
Copy link
Author

atorsvn commented Mar 13, 2025

Here is an example of usage after the revision

code

import ollama

# Define system prompt to guide the model's behavior
system_prompt = """
You are an expert AI assistant specializing in space exploration. 
Always provide well-structured answers and explain your thought process before answering.
Place thoughts between <think></think> tags
"""

messages = [
    {"role": "system", "content": system_prompt},  #
    {"role": "control", "content": "thinking"},  # Should now work!
    {"role": "user", "content": "Why is the sky blue?"}
]

response = ollama.chat(
    model="granite3.2:2b-instruct-q4_K_M",
    messages=messages
)

print(response.message.content)

output

<think> The color of the sky is a result of complex interactions involving both physics and atmospheric chemistry, primarily driven by the presence of gases in Earth's atmosphere. Let's break down this fascinating phenomenon into key steps:

1. **Sunlight Reaches Us**: The sun emits light that spans a range of colors from vioan to red. This is because light is composed of different wavelengths, similar to how white light can be created by mixing all the visible colors.

2. **Atmosphere Absorbs Most Colors**: Earth's atmosphere absorbs most of the longer wavelengths (red and orange) due to gas molecules like nitrogen and oxygen. This is why the sky appears blue to us during a clear day.

3. **Blue Light Survives**: The shorter wavelength light, which includes blue and violet, penetrates more deeply into our atmosphere because it's less absorbed by these gases.

4. **Rayleigh Scattering**: This is the process responsible for why the sky appears blue. When sunlight enters Earth’s atmosphere, it encounters gas molecules and particles like dust. The light gets scattered in all directions due to a phenomenon called Rayleigh scattering.

5. **Blue Light's Directional Path**: Blue light has shorter wavelengths compared to other colors, and as it gets scattered, this blue is dispersed more than the rest of the spectrum because its particles are smaller—a property known as Mie scattering for larger particles (like dust). This results in a greater proportion of blue light traveling towards our eyes.

6. **Our Perception**: Our eyes then interpret this predominance of blue light, and we perceive the sky as blue.
</think>

In summary, the blue color of the sky is primarily due to an atmospheric phenomenon called Rayleigh scattering. This process scatters shorter wavelengths of visible light—primarily blue—more than longer-wavelength colors, like red or yellow, because they interact more with molecules in Earth's atmosphere. As a result, we see the sky as blue on clear days.```

@atorsvn
Copy link
Author

atorsvn commented Mar 13, 2025

Note. This supports all of the literals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant