Skip to content

Instantly share code, notes, and snippets.

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")
@Struki84
Struki84 / main.go
Last active September 1, 2023 00:14
Test implementation of webscraping + langchain summarization logic
package browser
import (
"context"
"fmt"
"gpt/tools/scraper"
"strings"
"github.com/tmc/langchaingo/chains"
"github.com/tmc/langchaingo/documentloaders"
// 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"
@Struki84
Struki84 / chat.rb
Last active April 17, 2019 17:53
Sinatra web socket gem integration, taken out of Sinatra modular application
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
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) {
@Struki84
Struki84 / main.js
Last active January 6, 2017 20:32
Media specific css
$(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")
});
});
//Consider the scenario
class Foo {
var foBarVar: String?
init() {
foBarVar = "Test"
}