Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
from llama_index.core.agent import AgentRunner
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.tools import FunctionTool
from llama_index.llms.openai import OpenAI
def weather_tool(city: str):
"""
[
{
"insertId": "qzv45vopsusy6nv1",
"jsonPayload": {
"fields": {
"message": "Apollo Router v1.4.0 // (c) Apollo Graph, Inc. // Licensed as ELv2 (https://go.apollo.dev/elv2)"
},
"target": "apollo_router::executable",
"level": "INFO",
"timestamp": "2022-11-28T09:34:46.032103Z"
@psyho
psyho / cli_builder.rb
Created September 1, 2016 17:12
CLI builder example
module HashConstructor
def initialize(attrs = {})
attrs.each do |name, value|
send("#{name}=", value)
end
end
end
class AwsCli
include HashConstructor
@psyho
psyho / core.clj
Last active October 15, 2015 07:46
Property-based testing dojo
(ns dojo.core
(:require [clojure.test.check :as tc]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop]
[clojure.test :refer :all]))
(def balls identity)
(defn add-ball [rack ball] (conj rack ball))
@psyho
psyho / foo_spec.rb
Created April 29, 2014 15:08
How to combine Bogus and rspec-mocks (or other mocking library) in one project
require 'spec_helper'
class Foo
def initialize(bar)
@bar = bar
end
def foo
@bar.bar
end
@psyho
psyho / bogus-minitest.rb
Created May 11, 2013 08:56
Bogus.have_received in minispec
require 'minitest/autorun'
require 'set' # bummer, I forgot to require set in Bogus
require 'bogus'
class Foo
def bar(x, y)
end
end
module Bogus
@psyho
psyho / notatki
Created April 10, 2013 22:12
Notatki z SCKRK #40 - Lean Coffee
Tematy:
* sckrk workshops (4)
- warsztaty z security
* open data (4)
- jak uwalniać dane z miasta
* why we fail in tdd and what we do about it (7)
* ddd-krk (7)
- nowy meetup dla ludzi z DDD
* formuła spotkań (3)
- co poza reading club i lean coffee
@psyho
psyho / Gemfile
Created November 2, 2012 11:20
Typhoeus 0.4.2 Memory Leak
source :rubygems
# no leak in version 0.3.3
# gem 'typhoeus', '0.3.3'
# memory leaking very fast (1Mb/s) in version 0.4.2
gem 'typhoeus', '0.4.2'