Skip to content

Instantly share code, notes, and snippets.

View thebennos's full-sized avatar
🎯
Target

Benjamin thebennos

🎯
Target
View GitHub Profile
@wiseman
wiseman / agent.py
Last active April 21, 2025 17:37
Langchain example: self-debugging
from io import StringIO
import sys
from typing import Dict, Optional
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents.tools import Tool
from langchain.llms import OpenAI
@edsu
edsu / pizza.txt
Last active February 3, 2018 21:31
An example of looking up Pizza in Wikidata, to see the equivalent entities on other Wikipedias using the wggetentities call in the Wikidata API http://wikidata.org/w/api.php. The use of python as a filter on the end of curl is just to pretty print the JSON. You can obviously leave it off if you don't have Python available. In response to https:/…
curl "https://www.wikidata.org/w/api.php?action=wbgetentities&sites=itwiki&titles=Pizza&format=json" | python -mjson.tool
{
"entities": {
"q177": {
"descriptions": {
"de": {
"language": "de",
"value": "Gericht"
},
"en": {
@rafinskipg
rafinskipg / views_programatically.php
Created November 2, 2012 12:42
Creating views Drupal 7 programatically, with exposed filters and order by
$view = 'my_view_name';
$display = 'my_display';
$alter = array('exposed' => array('title' => 'title I search'), 'node_created_order' => 'ASC');
//Simple results of a view
public function getResults($view, $display, $args = NULL){
return views_get_view_result($view, $display, $args);
}
//View with exposed filters and more things