Skip to content

Commit

Permalink
Update (g4f/Provider/GizAI.py)
Browse files Browse the repository at this point in the history
  • Loading branch information
kqlio67 committed Nov 11, 2024
1 parent 2542287 commit 2a29f1b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions g4f/Provider/GizAI.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class GizAI(AsyncGeneratorProvider, ProviderModelMixin):
url = "https://app.giz.ai"
url = "https://app.giz.ai/assistant"
api_endpoint = "https://app.giz.ai/api/data/users/inferenceServer.infer"
working = True
supports_stream = False
Expand Down Expand Up @@ -46,7 +46,7 @@ async def create_async_generator(
'Connection': 'keep-alive',
'Content-Type': 'application/json',
'DNT': '1',
'Origin': cls.url,
'Origin': 'https://app.giz.ai',
'Pragma': 'no-cache',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
Expand All @@ -56,16 +56,21 @@ async def create_async_generator(
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Linux"'
}

prompt = format_prompt(messages)

async with ClientSession(headers=headers) as session:
data = {
"model": model,
"input": {
"messages": messages,
"messages": [{"type": "human", "content": prompt}],
"mode": "plan"
},
"noStream": True
}
async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
response.raise_for_status()
result = await response.json()
yield result['output'].strip()
if response.status == 201:
result = await response.json()
yield result['output'].strip()
else:
raise Exception(f"Unexpected response status: {response.status}")

0 comments on commit 2a29f1b

Please sign in to comment.