MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / get_openai_embed

Function get_openai_embed

llm/embedding.py:26–41  ·  view source on GitHub ↗
(model, input)

Source from the content-addressed store, hash-verified

24 interval=20
25)
26def get_openai_embed(model, input):
27 openai.api_key = CONFIG['emb_api_key']
28 openai.api_type = "azure"
29 openai.api_base = "https://gpt-jp-az.openai.azure.com/"
30 openai.api_version = "2023-05-15"
31 openai.debug = True
32 with requests.Session() as session:
33 openai.requestssession = session
34 try:
35 response = openai.Embedding.create(
36 engine=model, input=input)
37 result = [e['embedding'] for e in response['data']]
38 except Exception as e:
39 result = 'error:{}'.format(e)
40 print(result)
41 return result
42
43
44if __name__ == '__main__':

Callers 2

embed_by_openaiFunction · 0.90
embedding.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected