mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-16 16:51:02 +02:00
Based AzureOpenAI support
This commit is contained in:
parent
d219b9a7cd
commit
f861399a8d
2 changed files with 7 additions and 8 deletions
|
|
@ -83,6 +83,7 @@ setuptools.setup(
|
|||
"scripts/rows-write-cassandra",
|
||||
"scripts/run-processing",
|
||||
"scripts/text-completion-azure",
|
||||
"scripts/text-completion-azure-openai",
|
||||
"scripts/text-completion-claude",
|
||||
"scripts/text-completion-cohere",
|
||||
"scripts/text-completion-llamafile",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
"""
|
||||
Simple LLM service, performs text prompt completion using the Azure
|
||||
serverless endpoint service. Input is prompt, output is response.
|
||||
OpenAI endpoit service. Input is prompt, output is response.
|
||||
"""
|
||||
|
||||
import requests
|
||||
|
|
@ -66,17 +66,14 @@ class Processor(ConsumerProducer):
|
|||
]
|
||||
)
|
||||
|
||||
self.api = api
|
||||
self.endpoint = endpoint
|
||||
self.token = token
|
||||
self.temperature = temperature
|
||||
self.max_output = max_output
|
||||
self.model = model
|
||||
|
||||
self.openai = AzureOpenAI(
|
||||
api_key=self.token,
|
||||
api_version=self.api,
|
||||
azure_endpoint = self.endpoint,
|
||||
api_key=token,
|
||||
api_version=api,
|
||||
azure_endpoint = endpoint,
|
||||
)
|
||||
|
||||
def handle(self, msg):
|
||||
|
|
@ -91,10 +88,11 @@ class Processor(ConsumerProducer):
|
|||
|
||||
prompt = v.prompt
|
||||
|
||||
|
||||
try:
|
||||
|
||||
with __class__.text_completion_metric.time():
|
||||
resp = self.openai.completions.create(
|
||||
resp = self.openai.chat.completions.create(
|
||||
model=self.model,
|
||||
messages=[
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue