This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Experiment: The LLM is asked to generate a number, but it can only generate 0 or 1. | |
The probability of generating 0 is 90%, and the probability of generating 1 is 10%. | |
The LLM is asked to generate 100 numbers, and the number of 0s generated is counted. | |
The actual probability of generating 0 is then calculated. | |
""" | |
from openai import OpenAI | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this code file is from https://github.com/DissonanceTK/MacReddy fork and is licensed under the MIT License. | |
""" | |
MIT License | |
Copyright (c) 2024 ILikeAI | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import random | |
import time | |
# emulate a time consuming task | |
async def task_A(char): | |
time_to_sleep = random.randint(1, 3) | |
id = f'Product_{char}[{time.strftime("%M:%S", time.localtime())}, {time_to_sleep}s]' | |
print("Producing: " + id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is responsible for the communicating with the Ollama Server | |
import json | |
import requests | |
class Ollama: | |
''' | |
This class is responsible for communicating with the Ollama Server. | |
The conversation memory is stored inside this class. | |
''' |