This file contains 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
func Prompt(input string, options ...chains.ChainCallOption) { | |
llm, err := openai.NewChat(openai.WithModel("gpt-4")) | |
if err != nil { | |
log.Fatal(err) | |
} | |
// dsn := "host=localhost user=gpt-admin password=gpt-password dbname=gpt-db port=5432" | |
// memory := memory.NewPostgreBuffer(dsn) | |
// memory.SetSession("USID-001") |
This file contains 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
package browser | |
import ( | |
"context" | |
"fmt" | |
"gpt/tools/scraper" | |
"strings" | |
"github.com/tmc/langchaingo/chains" | |
"github.com/tmc/langchaingo/documentloaders" |
This file contains 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
// An example of my custom DB adapter, a gorm based wrapper for a postgres database, | |
// implements the DBAdapter interface. | |
package main | |
import ( | |
"database/sql/driver" | |
"encoding/json" | |
"errors" |
This file contains 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
require 'sinatra-websocket' | |
class ChatController < Sinatra::Base | |
enable :method_override | |
set :channels, [] | |
# set :views, '/var/www/app/views' | |
set :root, File.dirname(File.dirname(__FILE__)) | |
register Sinatra::Reloader | |
helpers do |
This file contains 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
Node.js - Questions | |
+ Q: What is an error-first callback? | |
A: I have used this style convention, never knew it was a "thing", I googled it :). It is an accepted style of formatting | |
your callback data in a way to separate your err response from your data response, and return error as the first argument, | |
in a way always anticipating the error. It is more of a preference than an actual design pattern since a lot of programmers | |
set an error check condition before running any other operations on executing callback, eg: | |
var callback = function(error, data) { | |
if (error) { |
This file contains 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
$(document).ready(function(){ | |
$('.nav a').on('click', function(){ | |
$('.btn-navbar').click(); //bootstrap 2.x | |
$('.navbar-toggle').click() //bootstrap 3.x by Richard | |
//Print log in the broser console... | |
console.log("My script is Runing") | |
}); | |
}); |
This file contains 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
//Consider the scenario | |
class Foo { | |
var foBarVar: String? | |
init() { | |
foBarVar = "Test" | |
} | |