logo elektroda
logo elektroda
X
logo elektroda

Ollama API Tutorial - AI chatbots 100% local to use in your own projects

p.kaczmarek2 1827 13
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • Screenshot of the Ollama Chat App with a model dropdown and chat fields. .
    How to make a project based on the latest language models available locally, such as deepseek-r1, llama, qwen, gemma and mistral? How does Ollama's uniform interface based on HTTP requests work? Here I will try to demonstrate this. We will learn how to send chat requests containing both text and images. The method discussed will allow you to run simple chatbots/assistants from virtually any device capable of making HTTP requests - so even from a Raspberry or from boards with ESP8266/ESP32....

    As an introduction, let me remind you of related topics in the series. I have already been running the language model API from OpenAI on the ESP8266:
    ESP and ChatGPT - how to use OpenAI API on ESP8266? GPT-3.5, PlatformIO .
    I have also already presented a way to run language models on your own machine based on the aforementioned Ollama WebUI:
    ChatGPT locally? AI/LLM assistants to run on your computer - download and install .
    I have also shown DeepSeek derived models based on this:
    Running a miniaturised DeepSeek-R1 on consumer hardware - Ollama WebUI

    Now it's time for an intermediate topic - here I will show how to use the Ollama API, quite analogous to the API from OpenAI, only here the server will also be our machine.

    Initial requirements .
    In the theme I assume we already have the WebUI set up along with some sample models downloaded, this can be done according to my old tutorial .
    As a check that everything is working, we fire up our WebUI in Docker and ask it a question:
    User interface with content on calculating copper trace resistance. .
    We make sure that everything works. Only then can we move on.


    Basics of the API .
    First we need to know the port on which Ollama is set up. This is not the same port that WebUI is on. It is easy to find it in Docker:
    Docker Desktop screen showing the ollama container highlighted .
    Then, as a test, you can look in your browser at the address listing the available models:
    
    http://192.168.0.213:11434/api/tags
    
    .
    We should receive the list in JSON format:
    Screenshot of a browser displaying an API model list. .
    This confirms that the API is working and allows us to move on to the next step.

    Listing models in practice .
    So let's make a simple chat imitation application for a test. I decided to make it in C# - based on WinForms, or Windows windows. I wrote in Visual Studio 2017, but of course you can pick up a newer version.
    We start by inserting the available models into the ComboBox dropdown list. We retrieve the models from the aforementioned API via HttpWebRequest, which returns JSON for us to parse via Newtonsoft.Json. We install this library beforehand:
    Screenshot from Visual Studio showing the NuGet Package Manager with Newtonsoft.Json installed. .
    And now the code - all in one file, without a visual editor:
    Code: C#
    Log in, to see the code
    .
    Subsequently the web request HttpWebRequest fetched data, we read it into the StreamReader stream and then create a JSON object from it using JObject.Parse. There we iterate through the array of models.
    It works:
    Screenshot of an application with a dropdown menu for selecting language models. .



    Simple query and response streaming .
    We already have the models available. Now it is time to put them to use.
    An endpoint is used to simply complete the text:
    
    http://192.168.0.213:11434/api/generate
    
    .
    We send a POST request with the data in the format:
    Code: JSON
    Log in, to see the code
    .
    There is also an optional stream argument - this specifies whether the response is streamed. We rather care about this, then there is a better effect and you can see in real time what is happening.
    This way we get a stream of JSON files in the response - word by word. This is the same effect as in ChatGPT. We have to add the received words to the displayed window ourselves.
    Code: JSON
    Log in, to see the code
    .
    The done field specifies whether the given JSON is the last fragment of the response.
    Updated code (I added a text box, button, etc):
    Code: C#
    Log in, to see the code
    .
    Now StreamReader reads line by line - and we convert these lines into separate JSONs.
    Example result:
    Ollama Chat App interface showing selected language model and sample conversation exchange. .

    Household minichat - basis .
    The chat allows you to send a conversation history split between the user and the assistant. An endpoint is used to create the chat:
    
    http://192.168.0.213:11434/api/chat
    
    .
    A POST request with data in JSON format needs to be sent there. At the very least, we need model selection (model field), conversation history (user messages and AI).
    An example of the JSON sent:
    Code: JSON
    Log in, to see the code
    .
    In response, we will receive a JSON stream of this format:
    Code: JSON
    Log in, to see the code
    .
    The last JSON received will be different:
    Code: C / C++
    Log in, to see the code
    .
    I've added a text box, button, etc to the code here, but that's the least important.
    Updated code:
    Code: C#
    Log in, to see the code
    .
    The most interesting thing is the SendButton_Click method - this is where the request is sent. I do this in a blocking way, so I suspend the GUI for the duration of the query, but this is just a demo version.
    The result:
    Screenshot of the Ollama Chat App with a model dropdown and chat fields. .
    Window of Ollama Chat App with a dropdown menu for model selection and a text field. .


    His own minichat - a history of exchanges .
    One thing left to do is to keep the full history of the conversation. Then the query looks like this for example:
    Code: JSON
    Log in, to see the code
    .
    So we separate the messageHistory into a window class and update it when the AI response is received.
    Code: C#
    Log in, to see the code
    .
    With each query we resend it. It's time to check the AI's memory:
    Screenshot of the Ollama Chat App application showing a chat conversation. .
    It works!
    Forgive the lack of spaces in the conversation, it's just a display issue. You can immediately have a longer conversation.
    Now one thing is worth noting - we can freely modify the text that the user or the model has written.

    Recognition of photos .
    Some AI models also support photos - llava, for example. Photos can be sent to them encoded in Base64. We append them to the chat query or autocomplete as an image array. The example query then looks like this:
    Code: JSON
    Log in, to see the code
    .
    Endpoint:
    
    http://192.168.0.213:11434/api/generate
    
    .
    The answer will be obtained in the format:
    Code: JSON
    Log in, to see the code
    .
    It is easy to convert bytes in C# to a string in Base64 format, we have a function ready for this:
    Code: C#
    Log in, to see the code
    .
    In this way, we can convert our chat so that it also supports images. By the way, we will use the drag&drop mechanism to be able to simply drag files onto our window:
    Code: C#
    Log in, to see the code
    .
    Result:
    Screenshot of the Ollama chat application with a model dropdown and Send button. .
    Ollama chat app interface with a model selection box, text entry window, image field, and Send button. .
    Analogously, you can attach images to a chat conversation. We then place them in the chat history, example below: .
    Code: JSON
    Log in, to see the code
    .
    Of course, the reliability of the llava model itself is a separate topic, which I have already presented on the forum:
    Minitest: robot vision? Multimodal AI LLaVA and workshop image analysis - 100% local .

    Summary .
    Ollama offers a unified system that allows multiple large language models to be run, both downloaded from the official project website and added manually from the GGUF file . These usually only support text, but there also happen to be 'multimodal' models, i.e. also supporting images, which we include here encoded in Base64 format. The API discussed here supports the possibility of 'streaming' operation, i.e. previewing responses in real time, which strongly resembles the operation of ChatGPT and allows us, in the event of a change of mind, to interrupt the generation of a response earlier and change the query.
    The API demonstration shown here was based on the C# language and WinForms, but it could just as well be realised on another platform, perhaps I'll present that soon too. So far I have another project in the frame, but I'll just say for now that it's quite related to electronics, details in the next topic.
    Have you already used the Ollama API in your projects? .
    PS: For more information I would refer you to the Ollam documentation , and especially their own description of the API . .

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 12389 posts with rating 10267, helped 584 times. Been with us since 2014 year.
  • ADVERTISEMENT
  • #2 21429710
    kjoxa
    Level 21  
    Great post, thanks! What is the configuration of the machine that the example code was communicating with? The response rate is accelerated?
  • #3 21429787
    p.kaczmarek2
    Moderator Smart Home
    I presented details of the machine used and a test of the speed of response here:
    Running the miniaturised DeepSeek-R1 on consumer hardware - Ollama WebUI .
    Response rates for different model sizes:



    Hardware:
    Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz, 64GB RAM, GeForce GTX 1060
    Helpful post? Buy me a coffee.
  • #4 21431307
    gulson
    System Administrator
    The most important thing is that our data does not leak. Thanks for the tutorial.
  • ADVERTISEMENT
  • #5 21431630
    krzbor
    Level 27  
    I have a question - how do these simplified deepseek models cope with the Polish language?
  • ADVERTISEMENT
  • #6 21431823
    p.kaczmarek2
    Moderator Smart Home
    At the moment, in my spare time, I'm working on an electronics exam for AI - I want to automatically see how these models will cope with various tasks. For this there will be a ready-made program so that I don't have to do anything manually.

    @krzbor let's test.

    Prompt:
    Describe what Ohm's law is, how it is applied, what it is used for. Use correct Polish. .

    deepseek-r1:1.5b wrote:
    .
    <think>
    Okay, so I need to figure out what Ohm's Law is and how it's used in real life. Let me start by recalling what I know about Ohm's Law.

    Ohm's Law is a fundamental concept in electrical engineering that relates voltage, current, and resistance. The basic formula is V = IR, where V stands for voltage (in volts), I is current (in amps), and R is resistance (in ohms). It states that the current through a conductor is directly proportional to the voltage and inversely proportional to the resistance.

    I remember it's often remembered by the acronym "V=IR." So whenever any two of these three variables are known, the third can be calculated. But how exactly does this apply in real-world scenarios?

    Let me think about when I might use Ohm's Law. Probably when designing or troubleshooting an electrical circuit. For example, if I have a resistor and I know the voltage across it and its resistance, I can calculate the current flowing through it. That would be useful for ensuring the resistor doesn't overheat.

    Wait, another thing-Ohm's Law also works with components like wires, inductors, and capacitors. So even beyond just resistors, these other elements follow this law when considering their respective currents, voltages, and resistances.

    Let me try to come up with some examples. Suppose I have a light bulb in a circuit powered by a battery. The resistance of the bulb changes with temperature (that's resistance temperature compensation), so using Ohm's Law would help calculate the current flowing through it to ensure the voltage drop across the bulb matches the expected value.

    Another scenario: if I'm working on an electronic device, understanding Ohm's Law can help me choose the right components. For instance, calculating how much resistor is needed in a circuit to limit the current to a safe level.

    Wait, what about when dealing with a short circuit? If the resistance is very low (like a wire), even a small voltage could cause significant current, which might damage an device or component. Ohm's Law helps in identifying such situations before they occur.

    I also wonder how this applies in everyday applications like household wiring. The wires have resistances, so without knowing it, I don't know what currents will flow through them when connected to a voltage source. Ohm's Law must be part of that calculation process.

    Let me think about a more practical example: if I have an electrical device with a resistance of 10 ohms and I connect it to a 9 volts battery, I can calculate the current using V=IR. Rearranging the formula, I = V/R = 9V / 10Ω = 0.9A. So, the device would draw 0.9 amps. This might help in checking if the device is likely to blow or not.

    Ohm's Law also plays a role in safety ratings for electronic components. Most devices have maximum current ratings based on their resistance. By using Ohm's Law, I can determine what the maximum voltage across such a component could be without exceeding its power limits.

    I should also consider that Ohm's Law is an approximation and assumes ideal conditions where there are no other factors like temperature changes affecting resistance or variations in circuit components. So, it might not account for all real-world complexities, but it's a useful starting point for analysis.

    In summary, Ohm's Law is essential for understanding the basic principles of current, voltage, and resistance in electrical circuits. It helps in designing, troubleshooting, and optimizing electronic systems by relating these three key variables.
    </think>

    Ohm's Law is a cornerstone in electrical engineering that establishes the relationship between voltage (V), current (I), and resistance (R) with the formula V = I × R. This law allows us to calculate one variable if we know the other two, facilitating various real-world applications.

    Key Applications:

    Designing Circuits: Engineers use Ohm's Law to determine component values, ensuring components like resistors or wires are chosen for safe current flow without overheating or damage.
    Troubleshooting: By calculating voltage drops across known resistances, it helps identify issues such as overcurrent in devices or unexpected resistance changes (e.g., temperature effects).
    Everyday Applications: Understanding Ohm's Law aids in analysing circuits like household wiring, where wires have inherent resistance. This knowledge is crucial for preventing short circuits and ensuring safe device operation.
    Safety Ratings: It helps assess components' maximum current limits based on resistance, enabling the creation of safety guidelines and ensuring devices operate within permissible parameters.
    In essence, Ohm's Law simplifies circuit analysis by providing a foundational understanding of how voltage, current, and resistance interact, aiding in design, troubleshooting, and everyday electrical life.
    .

    deepseek-r1:7b wrote:
    .
    <think>
    Okay, I need to describe Ohm's Law and explain how it's used with proper Polish grammar. First, what is Ohm's Law? From my studies, I remember it relates voltage, current, and resistance in an electrical circuit.

    So, the law states that the current through a conductor between two points is directly proportional to the voltage across the两点 and inversely proportional to the resistance of the conductor. In mathematical terms, V equals IR, where V is voltage, I is current, and R is resistance.

    Now, how is this law applied? Well, if you know two of the three values-voltage, current, or resistance-you can calculate the third one using Ohm's Law. For example, if you have a circuit with a known resistance and apply a certain voltage, you can find out the expected current by dividing the voltage by the resistance.

    It's also used in various practical applications like designing circuits, troubleshooting electrical problems, and ensuring safety in electrical systems by calculating the necessary components based on the desired current or voltage levels.

    I should make sure to explain this clearly in Polish, using proper grammar. Let me structure it step by step: first define Ohm's Law, then its formula, followed by how it's applied with examples if needed.
    </think>

    Ohm's Law describes the relationship between voltage, current and resistor in a conductor. Let us write it formally:

    Ohm's law is the relationship that states that the current intensity (I) in a conductor is proposed прямо proportional to the voltage (V) over the conductor and inversely proportional to its resistor (R). This can be written as:

    V=I×R

    The main applications of Ohm's law involve calculating one of the three quantities (voltage, current, or resistance) if the other two are known. For example, if you know the voltage and the resistance, you can calculate the current by dividing the voltage by the resistance.

    Ohm's law is an integral part of the basic principles of electrical engineering and is used in the design of Electrical systems, the diagnosis of Electrical problems and in pretty much any context where you need to calculate the characteristics ofElectrical conductors.
    .
    deepseek-r1:14b wrote:
    .
    <think>
    Okay, I need to explain what Ohm's Law is in Polish. Let me start by recalling what Ohm's Law is about.

    So, it's a basic concept in electronics that relates voltage, current, and resistance. The formula is V = I * R.

    Voltage (V) is the potential difference, current (I) is the flow of electrons, and resistance (R) limits that flow.

    I should mention how it's used in calculations, like finding one value when others are known.

    Also, it's important to note where Ohm's Law applies, which is in ohmic materials where resistance is constant regardless of voltage or current.

    Maybe add an example to make it clearer, like calculating current with a given voltage and resistance.

    I need to keep the language correct and clear in Polish, making sure all terms are accurately translated.
    </think>

    Ohm's law - is one of the most important laws in electrical engineering, which describes the relationship between voltage (volt), current (amp) and resistance (ohm). Introduced by Georg Simoni Ohm's law, this law states that in an ohmic body (where the ratio of stress to current is constant), the value of the current is equal to the quotient of stress and resistance. In other words:

    Current = Stress / Resistance

    In a mathematical formula this reads:

    I = V / R

    Where:

    I - current (in amperes, A),
    V - voltage (in volts, V),
    R - resistance (in ohms, Ω).
    Ohm's law is used when dealing with materials that have a constant current flow characteristic depending on the stress. This makes it possible to calculate values of unknown quantities in electrical mạchs, for example:

    If the resistance and stress are known, we can calculate the current,
    If the signs are current and resistance, we can calculate the stress.
    Ohm's law has general applications in the design and analysis of electrical mạchs, including electrical engineering, electronics and automation.
    .
    Version 1.5b of the parameters did not comprehend and answered in English, the two larger versions think in English but answer in "Polish" (?).

    Resistance in "ohms"? Electrical "mach"? Tension...

    Ok, now the other models.
    Interface for selecting an AI model with responses to a question about Ohm's law. .
    mistral:latest wrote:

    Ohm's law is a law of electronics that describes the relationship between the current of a fin and the voltage in a metal conductor. The law is formulated by the equation:

    J = I + α * V^2

    Where:

    J - ionic current,
    I - electron current,
    V - voltage in a metal conductor,
    α - Ohm's constant (property of the material).
    For the flow of small electron currents (ordinary current), this law can be simplified to the simpler Ohm's equation:

    V = R * I

    Where:

    V - voltage,
    R - resistance of the conductor,
    I - electron current.
    This law is fundamental to the theory and design of electrical systems and the analysis of their operation. It serves for the determination of voltages, currents, resistances and other properties of metal conductors in a variety of configurations. It is helpful for designing power systems, measuring voltages and currents and fault diagnosis in electrical systems.

    Flame current?

    llama3.1:8b wrote:

    Ohm's law - an electrical relationship for single-phase generators describing the relationship between voltage, current flow and electrical resistance of a circuit.

    According to Ohm's law, if the basic circuit consists of a voltage source with a voltage U, an internal resistance R and a battery with a voltage -U and a resistance r b (independent of current), then:

    U=I(R+rb) ,
    Where:

    U: the voltage between the two ends of the battery, in Volts,
    I: the current flowing through the circuit, in Amperes,
    R and rb : electrical resistances of the circuit and battery, in Ohms.
    This law was formulated in 1827 by the German physicist Georg S.J. Ohm (1789-1849).
    .
    qwen2.5:14b wrote:
    .

    Ohm's law is one of the most important laws in electricity and electrical engineering. It explains the relationship between electric current, electric resistance and electric voltage in a simple electrical system (e.g. a chain with a conductor and a current source).

    According to Ohm's law, the current intensity I flowing through a system is inversely proportional to the electrical resistance R of that system and directly proportional to the electrical voltage U at its ends. The mathematical formula for this law is:

    U=R⋅I

    or

    I= U/R



    Where:

    I is the current [A] (amps),
    U is the electrical voltage [V] (volts),
    R is the electrical resistance [Ω] (ohms).
    Ohm's law is used in many technical situations such as:

    Calculation of current: If the values of voltage and resistance are known, this law can be used to calculate the current flowing through a system.
    Calculation of voltage: If you know how much current flows and what the resistance is, you can calculate the voltage at the ends of an electrical circuit.
    Calculating resistance: If we know the current and voltage in the circuit, we can determine its electrical resistance.
    Ohm's law is of great importance in the design and analysis of electrical systems, from simple circuits to complex power installations. It is the basis for many engineering calculations relating to electricity and electronics.
    .

    phi4 wrote:

    Ohm's law is one of the fundamental laws of direct current in electricity, which describes the relationship between voltage (V), current (I) and resistance (R) of a circuit. The formula for Ohm's law is V=I×R. This means that the drop voltage of an electrical component is the product of the current flowing through the component and its resistance.

    Application of Ohm's Law
    Calculations in simple circuits :
    If the values of voltage and resistance are known, the current can be easily determined.
    For example : Given a voltage V=12 W (watts) and a resistance R=4 Ω (ohms), we calculate the current as I= V/R = 12/4 =3 A (amps).
    Electrical circuit design and analysis :
    Ohm's law is used to design and analyse simple electrical circuits, especially those operating on direct current, such as power systems for electronic devices.
    Diagnosis and troubleshooting :
    If there is a fault or abnormality in a circuit, analysing the voltage and current values can help to locate the problem.
    Applications
    Electrical circuit design : Engineers and designers use Ohm's law to ensure the correct operation of electrical circuits, such as installations in buildings or in electronic devices.
    Selection of suitable components : When selecting resistors or other passive components, we must always consider their properties as described by Ohm's law to avoid overloads or power shortages.
    Education : This is a fundamental concept taught in technical schools and in the field of electrical engineering.
    Ohm's law is an invaluable tool for understanding how currents flow through different materials and how to control these currents by changing the value of resistance in a circuit. Despite its simplicity, this law has wide applications in everyday life and technology.
    .

    gemma2:2b wrote:

    Description of Ohm's law
    Ohm's law describes the relationship between current (I), voltage (V) and resistance (R) in an electrical system.

    Here are the basic definitions:

    Voltage (V): The level of potential difference at a given point in a system that causes current to flow.
    Current (I): The number of electrons flowing through a circuit in a given time.
    R: Resistance - is the deviation of voltage under the influence of current.
    By your own comparison, how does current differ from voltage?

    Voltage is the 'force' that prompts the current to flow, and current is the 'recognition' of this force - it's like a motor that needs voltage to speed up (current).

    The principle of Ohm's law: V = I * R , i.e. the voltage in a circuit is equal to the product of the current and the resistance.

    What is the application of Ohm's law based on?

    Ohm's law is used to:

    Calculating the voltage (V) in electrical circuits: If we know the current (I) and resistance (R), we can calculate the voltage (V) using the formula V = I * R.
    Calculation of current (I): If we know the voltage (V) and the resistance (R), we can calculate the current (I) using the formula I = V / R.
    Diagnostics and analysis of electrical systems: Ohm's law is a fundamental element in research to better understand the functioning of electronic circuits and their performance.
    Use of Ohm's law in practice:

    Ohm's law is used in many areas such as:

    Electronics: Determining the voltage in the power supply of an electronic device or analysing its performance.
    Power engineering: Calculation of voltage and current in an electrical network.
    Mechatronics engineering: Analysis of the force generated by electrical systems, such as in electric motors.
    Remember that Ohm's law is a key element for understanding the operation and regulation of electrical systems.

    .
    llava wrote:

    Ohm's law is a physical law that determines the values of the input signal at the output of a given inverter. It is defined as follows:

    If the input is a voltage V, then the value of the output signal I is proportional to V and is:
    I= V/R
    where R is the resistance of the source.

    If the input is a current I, then the value of the output signal V is proportional to I and is:
    V=I⋅R

    This correct formula is used in electronics to predict the performance of regulator circuits, such as a power supply or a surge suppressor. By becoming familiar with its use, it is possible to verify that the performance of these devices is improved and that there is no translation between voltages and currents.
    .
    "A power supply or surge protector"?

    Which model do you think has coped best?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #7 21432277
    krzbor
    Level 27  
    How about the 32b model?
    Unfortunately the 14b performed poorly.
  • #8 21432595
    RebellionArts
    Level 23  
    Hey, maybe instead of just putting up LLM models tell how they can be trained. What does such a training file look like, where to get the data from.
    I am putting up models myself, I even had to deal with 405b from ollama. But it took me more time to create a file to teach a law or cybersecurity model. I didn't find too many Polish language versions, I had to use a language model translator to translate 200,000 lines of prompts for my model. Do you have any information on this?
  • #9 21432862
    p.kaczmarek2
    Moderator Smart Home
    I haven't delved into the topic of training/fine-tuning modei yet.

    Test with 32b deepseek-r1 for @krzbor :
    deepseek-r1:32b wrote:
    .
    <think>
    Okay, so I need to explain what Ohm's Law is, how it's applied, and its purpose. Hmm, let me start by recalling what I know about electricity. There's voltage, current, and resistance.... Right, Ohm's Law connects these three.

    Wait, the user asked for a Polish explanation using correct Polish. So, I should make sure my terms are accurate in Polish. Let me think about each component:

    Voltage is "voltage" or sometimes "voltage intensity".
    Current is "current".
    Resistance is "resistance".
    Ohm's Law formula is V = I * R. So, voltage equals current multiplied by resistance. But in Polish notation, it might be written as U = I * R? Or maybe they use V for voltage too.

    I should also explain each variable clearly. Maybe give examples of how to find one when the other two are known. Like finding current if you know voltage and resistance, or calculating resistance when voltage and current are given.

    Additionally, it's important to mention where Ohm's Law is applied. It's used in electronics for designing circuits, testing components, etc. So I should include that part too.

    Wait, did I cover all the points? Let me check: definition, variables explained, formula, applications, examples of usage. Yeah, that seems comprehensive. Now, how to present this clearly and concisely in Polish without making it too technical but still accurate.
    </think>

    Ohm's law is a fundamental law in electronics and electrical engineering that describes the relationship between voltage (voltage), current (current) and resistance (resistance). Here is a detailed explanation:

    Definition:
    Ohm's law states that the current flowing through a wire is proportional to the voltage applied at its ends and inversely proportional to the resistance of the wire.

    Variable:

    Voltage (U) - measured in volts (V).
    Current (I) - measured in amps (A).
    Resistance (R) - measured in ohms (Ω).
    Formula:
    Ohm's law is expressed by the formula:
    U=I×R
    Where:

    U denotes voltage,
    I denotes current,
    R denotes resistance.
    Applications:
    Ohm's law is crucial in the design and analysis of electrical circuits. It is used for:

    Calculating the value of voltage when we know the current and resistance.
    Calculating the value of current when we know voltage and resistance.
    Calculating the value of resistance when we know the voltage and current.
    Examples:

    If we have a circuit with a voltage of 12 V and a resistance of 6 Ω, the current is:
    I=U/R=12V/6Ω=2A
    If the current in the circuit is 3 A and the resistance is 4 Ω, the voltage is:
    U=I×R=3A×4Ω=12V
    Conductive values:
    Ohm's Law enables the Analysis of electrical circuits, ensuring safe circuit design and testing.
    .

    I don't think these models were trained for Polish....
    Helpful post? Buy me a coffee.
  • #10 21433021
    krzbor
    Level 27  
    Thanks for the test. As I read 32b already requires a good graphics card or a lot of patience (when operating on RAM). The results are still poor. However, I noticed that even the weakest model understood the text written in Polish. If you have the opportunity, give the weakest ones (1.5b, 7b) some longer text in Polish (a little more complex and let them answer your question (the question in Polish and the answer can be in English). We'll see if it's suitable for automation - you can force it to answer in JSON or something similar.
  • #11 21434387
    Kera62
    Level 8  
    Hello,
    "Ol lama API Tutorial-chatbots AI 100% locally for use in your own projects"

    I may be too old (62 years old) to go into this topic, but what I've read here is really fascinating, especially because the tests are promising when translated into Polish
    I would be interested in such a private chat room, with the possibility of e.g. training and self-development of such a "device" AI or, as they call it, synthetic intelligence.
    Electronics has always interested me, but there was not much time for knowledge, so such a private educational system with hints in the field of electronics and Arealtics, because everything that flies in the sky is my life passion, when I was young I flew in the Pomeranian Aero-club, and since a long time I returned to the roots and models aircrafts.....Electronics is not standing still in this field either, so creating new and more perfect control devices, or TV vision and transmission of TV signals, or safety electronics, so as not to lose the model, autopilot and similar devices, e.g.: guiding for landing, or supplying with electricity, would be helpful and would affect the safety of flying a Model,
    and if it were still possible to communicate verbally with this device instead of writing these "Models" it would be an even more exciting experience :) .
    I will be watching these advances and I tip my hat to the new generation of programmers, hopefully for peaceful and sensible use of such knowledge, not militarily.
    I hope that this AI will not have a negative impact, and will not take control over the human element, and will be used by humans to develop and accelerate technical progress in many areas of our lives.
  • #12 21435821
    Jacek Rutkowski
    Level 28  
    Kera62 wrote:
    I will be looking at these advances and I will lean my hat to the new generation of programmers, I hope, for peaceful and sensible use of such knowledge, and not militarily.
    I hope that this AI will not affect negatively, and will not take control over the human element, and will be used by people for the development and faster technical progress in many areas of our lives.
    .
    Unfortunately, everything is for cash and armaments.
    What is 'civilian' and 'penny-wise' is beta testing or corpo and military....
  • #13 21436454
    katakrowa
    Level 23  
    If anyone wants to test different models without, as it were, complicated games of manual configuration and editing JSON files I recommend:
    https://lmstudio.ai/

    The Windows application installs like any "setup". The whole thing requires virtually no skill on the part of the user other than reading skills.
    Models are added by "clicking" on the page. https://lmstudio.ai/models (this is a list of available models).
    It is also possible to fire up a model in API mode over HTTP.... Also a few clicks in the options and we have an API over HTTP on localhost.

    However, let's be honest... On a home computer without a good accelerated card it all runs very poorly compared to commercial services that are a pittance....
    On top of this, the models available as free for home use are quite a distance from their commercial counterparts. It makes little economic sense to put up a model at home.
    Perhaps it makes sense for someone who is particularly keen on privacy or simply to play on their own.

    Screenshot of LM Studio with text about elektroda.pl
  • #14 21577977
    p.kaczmarek2
    Moderator Smart Home
    I add to the mini-program the option to download a new model, just endpoint for this:
    
    http://192.168.0.213:11434/api/pull
    
    .
    I will then attach the new code to the post.
    Ollama Chat App window showing model download progress with ID e8ad13eff07a.
    Helpful post? Buy me a coffee.
📢 Listen (AI):

Topic summary

The discussion centers on implementing AI chatbots using the Ollama API to run advanced language models locally via HTTP requests, enabling deployment on diverse hardware including Raspberry Pi and ESP8266/ESP32 boards. The author demonstrates interfacing with models such as deepseek-r1, llama, qwen, gemma, and mistral, highlighting the uniform API approach for sending chat requests with text and images. Performance tests on consumer hardware (Intel i7-6700HQ, 64GB RAM, GTX 1060) show varied response rates depending on model size. Language support, particularly for Polish, is limited; smaller models (1.5b, 7b) show partial comprehension but produce inconsistent Polish output, while larger models require substantial GPU resources and still yield suboptimal results. Training and fine-tuning remain unexplored by the author, with community interest in data preparation and multilingual adaptation. Alternative tools like LM Studio offer simplified local model deployment with HTTP API support but face performance constraints without high-end GPUs. The author also adds functionality for remote model downloading via a dedicated API endpoint. Privacy and data security are emphasized as key advantages of local AI deployment. Overall, the thread provides practical insights into local LLM usage, hardware requirements, language limitations, and API-based integration for embedded and desktop environments.
Summary generated by the language model.
ADVERTISEMENT