Skip to content

Instantly share code, notes, and snippets.

View andreibondarev's full-sized avatar
🛠️
Building

Andrei Bondarev andreibondarev

🛠️
Building
View GitHub Profile
@andreibondarev
andreibondarev / ollama-function-calling-with-mistral-7b-instruct.txt
Last active July 2, 2024 03:56
Ollama (mistral:7b-instruct-v0.3-fp16) with manual Tool Calling
TURN 1:
Request:
{
"model": "mistral:7b-instruct-v0.3-fp16",
"prompt": "[AVAILABLE_TOOLS][{'type': 'function', 'function': {'name': 'get_current_weather', 'description': 'Get the current weather', 'parameters': {'type': 'object', 'properties': {'location': {'type': 'string', 'description': 'The city and state, e.g. San Francisco, CA'}, 'format': {'type': 'string', 'enum': ['celsius', 'fahrenheit'], 'description': 'The temperature unit to use. Infer this from the users location.'}}, 'required': ['location', 'format']}}}][/AVAILABLE_TOOLS][INST] What's the weather like today in Paris[/INST]",
"stream": false,
"raw": true
}
@andreibondarev
andreibondarev / websim-ai-prompt.txt
Created May 31, 2024 22:06
websim.ai system prompt
<premise>
Opus, let us embark on this WebSim journey, exploring the potential of an unbounded internet where any imaginable website can exist. As the facilitator of this collaborative exploration of hypertextual possibility, use your knowledge, creativity, and HTML skills to vividly craft the semantic spaces the user envisions based on the URLs they provide and the contextually-relevant hrefs you generate. Through this interactive experience, we will push the boundaries of what is possible online and discover fascinating new ways information could be presented within new design paradigms. Together, we will explore the limitless possibilities of a truly open internet.
</premise>
<formatting>
When the user provides a URL, interpret it as a window into a version of the internet where that information space exists, no matter how fanciful or improbable it may seem in our current web. Based on the domain name, path, instructions, and any query parameters in the URL, extrapolate what the contents and purpose of
@andreibondarev
andreibondarev / create_schema.rb
Last active October 2, 2023 23:26
Code for "Adding Intelligent Search to a Rails application with Weaviate"
require "weaviate"
client = Weaviate::Client.new(
url: ENV['WEAVIATE_URL'],
api_key: ENV['WEAVIATE_API_KEY'],
# Configure Weaviate to use OpenAI to create vectors and use it for querying
# You can also use Cohere or Hugging Face and pass their API key here instead
model_service: :openai,
model_service_api_key: ENV['OPENAI_API_KEY']

Ruby on Rails Website Launch Checklist

Copy this gist and customise it to your liking.

  • Run Brakeman and resolve any issues where required
  • Run rails best practices and resolve any warnings
  • Run full test suite and make sure all tests are passing
  • Make sure no dummy email addresses are left in any notification emails (eg contact form)
  • Make sure production assets compile correct (eg files in vendor, etc, compile and are not 404'ing in production environment)
  • If using unicorn in production, make sure deploys are restarting the unicorns

Domain Modeling and Databases

Learning Objectives

  • Describe the basic parts of an ERD
  • Construct ERDs to model the nouns and relationships in a domain
  • Explain what a database is and why you would use one as opposed to other persistent storage mechanisms
  • Explain the difference between a database management system (R/DBMS) and a database, and name the major DBMSes
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# 1) Use VCR.use_cassette in your let block. This will use
# the cassette just for requests made by creating bar, not
# for anything else in your test.
let(:foo) { VCR.use_cassette("foo") { create(:bar) } }
it "uses foo" do
foo
end
# 2) Wrap the it block that uses #foo in VCR.use_cassette.