Skip to content

Instantly share code, notes, and snippets.

@ecdedios
Last active October 5, 2023 23:58
Show Gist options
  • Save ecdedios/8792417ec5e1c087acf3074be4e86bb7 to your computer and use it in GitHub Desktop.
Save ecdedios/8792417ec5e1c087acf3074be4e86bb7 to your computer and use it in GitHub Desktop.
semantic kernel chatgpt
import semantic_kernel as sk
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
kernel = sk.Kernel()
api_key, org_id = sk.openai_settings_from_dot_env()
kernel.add_text_completion_service("dv", OpenAIChatCompletion("gpt-3.5-turbo", api_key, org_id))
with open('resume.txt', encoding='utf-8') as f:
lines = f.readlines()
user_input = input('\nWhat is your question? ')
prompt = ' '.join(lines) + ' ' + user_input
response = kernel.create_semantic_function(prompt)
print(response())
print("\n\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment