Skip to content

Instantly share code, notes, and snippets.

View gaborcselle's full-sized avatar

Gabor Cselle gaborcselle

View GitHub Profile
@gaborcselle
gaborcselle / gist:b18b693cfb6da2daa9ce
Created December 16, 2014 23:40
MPTableViewAdPlacer integration overview
// MoPub MPTableViewAdPlacer integration overview
// In table view controller:
self.adPlacer = [MPTableViewAdPlacer placerWithTableView:self.tableView
viewController:self
defaultAdRenderingClass:[SomeTableViewAdCell class]];
...
[self.adPlacer loadAdsForAdUnitID:@"mopub_ad_unit_id"];
// In format definition:
@gaborcselle
gaborcselle / one_parallel_function.py
Created November 7, 2023 17:56
Parallel function calling code example from OpenAI Nov 2023 Dev Day, with a crude patch that makes it work https://platform.openai.com/docs/guides/function-calling
import openai
import json
# Crudely patched version of: https://platform.openai.com/docs/guides/function-calling
# TOOD: Add your open key here.
openai.api_key = ""
# Example dummy function hard coded to return the same weather
# In production, this could be your backend API or an external API
@gaborcselle
gaborcselle / travel_planning_example.py
Last active November 9, 2023 11:32
A better example for OpenAI's new parallel function calling API launched at Dev Day in Nov 2023
import openai
import json
#TODO: Add your OpenAI key here.
openai.api_key = ""
"""
The new OpenAI's new parallel function calling API launched at Dev Day in Nov 2023
can coordinate multiple function calls and feed the results back to the model.
diff --git a/examples/Customizing_embeddings.ipynb b/examples/Customizing_embeddings.ipynb
index 4068254..eaaa871 100644
--- a/examples/Customizing_embeddings.ipynb
+++ b/examples/Customizing_embeddings.ipynb
@@ -51,7 +51,7 @@
"from sklearn.model_selection import train_test_split # for splitting train & test data\n",
"import torch # for matrix optimization\n",
"\n",
- "from openai.embeddings_utils import get_embedding, cosine_similarity # for embeddings\n"
+ "from utils.embeddings_utils import get_embedding, cosine_similarity # for embeddings\n"